搜索插件、代码仓与 APP 分类

snow_fall_animation 封面
插件详情v0.0.1+3

snow_fall_animation

一个创建精美雪景动画和效果的Flutter插件

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
11
喜欢数
64
Pub 分数
150

安装插件

flutter pub add snow_fall_animation

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 插件,可为应用程序生成逼真且可自定义的雪花飘落动画。它使开发者能够在 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台上添加动态且视觉效果出色的雪景效果。该动画支持多种配置,例如雪花大小、速度、密度和方向,非常适合季节性或冬季主题的用户界面。专为性能而设计,使用简单的 API 可无缝集成到现有的 Flutter 项目中。非常适合在节日期间提升用户体验或创建沉浸式背景。

适合场景

  • 冬季主题的应用界面
  • 假日活动促销
  • 沉浸式背景视觉效果
  • 季节性移动游戏环境
  • 动画启动画面
  • 互动数字贺卡

主要特点

  • 可自定义的雪花外观
  • 可调节的下落速度和密度
  • 多平台支持
  • 所有设备上的流畅性能
  • 与 Flutter widget 的简单集成
  • 可配置的动画方向和随机性

适合对象

  • 开发季节性应用程序的开发者
  • 寻求动画背景的设计者
  • 构建节日数字体验的团队
  • Flutter 初学者探索视觉效果
  • 针对冬季假日的应用

使用建议

  • 可能会影响低端设备的性能
  • 需要仔细调整才能获得最佳帧率
  • 限于视觉效果,不包括交互元素
  • 不适合非季节性或极简风格的设计
  • 最好与轻量级 UI 组件一起使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

❄️ Snow Fall Plugin ❄️

Transform your Flutter app into a winter wonderland

pub package likes popularity

• Realistic snow animations • Custom emoji support • Smooth performance • Easy implementation • Full customization

Snow Fall Demo


Table of Contents

Features

  • 🌨️ Realistic snow fall animation
  • 🎄 Support for custom emojis (snowflakes, Christmas-themed, etc.)
  • ⚡ Smooth performance with multiple animation styles
  • 🎮 Customizable controls for speed, density, and wind effects
  • 🏔️ Optional snow accumulation at the bottom
  • 🎯 Easy to implement with minimal setup
  • 📱 Works on all Flutter platforms
Demo Examples
'Default Snow' 'Christmas Magic' 'Winter Wonderland'

Getting Started

Installation

Add snow_fall_animation to your pubspec.yaml:

dependencies:
  snow_fall_animation: ^0.0.1+2

Or install via command line:

flutter pub add snow_fall_animation
Basic Usage
import 'package:snow_fall_animation/snow_fall_animation.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          // Your background
          Container(
            decoration: BoxDecoration(
              gradient: LinearGradient(
                begin: Alignment.topCenter,
                end: Alignment.bottomCenter,
                colors: [
                  Colors.blue[900]!,
                  Colors.blue[700]!,
                ],
              ),
            ),
          ),

          // Snow fall animation
          SnowFallAnimation(
            config: SnowfallConfig(
              numberOfSnowflakes: 200,
              speed: 1.0,
              useEmoji: true,
              customEmojis: ['❄️', '❅', '❆'],
            ),
          ),

          // Your content
          YourContent(),
        ],
      ),
    );
  }
}

Configuration Properties

SnowfallConfig Properties
Property Type Default Range/Values Description
numberOfSnowflakes int 200 50-500 Number of snowflakes displayed on screen
speed double 1.0 0.1-3.0 Base falling speed of the snowflakes
useEmoji bool true true/false Whether to use emojis or basic shapes
customEmojis List<String> ['❄️', '❅', '❆'] Any emoji list List of emojis to use as snowflakes
snowColor Color Colors.white Any Color Color of non-emoji snowflakes
holdSnowAtBottom bool true true/false Whether snow accumulates at bottom
cleanupDuration Duration 3 seconds Any Duration Time taken for cleanup animation
accumulationDuration Duration 10 seconds Any Duration Time between cleanup cycles
minSnowflakeSize double 2.0 1.0-10.0 Minimum size of snowflakes
maxSnowflakeSize double 8.0 1.0-20.0 Maximum size of snowflakes
swingRange double 1.0 0.0-2.0 Horizontal swing amplitude
rotationSpeed double 1.0 0.0-3.0 Rotation speed of snowflakes
maxSnowHeight double 50.0 0.0-100.0 Maximum height of accumulated snow
enableSnowDrift bool true true/false Enable horizontal drifting
windForce double 0.0 -2.0-2.0 Horizontal wind force (negative = left)
enableRandomSize bool true true/false Randomize snowflake sizes
enableRandomOpacity bool true true/false Randomize snowflake opacity
minOpacity double 0.5 0.0-1.0 Minimum snowflake opacity
maxOpacity double 1.0 0.0-1.0 Maximum snowflake opacity

Presets & Effects

Animation Effects
Effect Properties Values Description
Heavy Snow numberOfSnowflakes
speed
300-500
1.5-2.0
Dense, fast-falling snow
Light Snow numberOfSnowflakes
speed
50-100
0.5-0.8
Sparse, gentle snow
Blizzard windForce
speed
1.5-2.0
2.0-3.0
Strong sideways wind
Gentle Drift windForce
swingRange
0.2-0.5
0.5-1.0
Slight drifting motion
Preset Configurations
// Christmas Magic
SnowfallConfig
(
numberOfSnowflakes: 200,
speed: 1.0,
customEmojis: ['❄️', '🎅', '🎄', '🎁', '⭐'],
windForce: 0.5,
)

// Winter Wonderland
SnowfallConfig(
numberOfSnowflakes: 250,
speed: 1.2,
customEmojis: ['❄️', '⛄', '🦌', '✨', '⭐'],
windForce: 1.0,
)

// Cozy Christmas
SnowfallConfig(
numberOfSnowflakes: 120,
speed: 0.5,
customEmojis: ['❄️', '🕯️', '🧦', '🍪', '🥛'],
windForce:
0.2
,
)

Emoji Groups

Available Emojis
Category Emojis Purpose
Snow ❄️ ❅ ❆ ✻ ✼ Basic snow effects
Christmas 🎅 🤶 🎄 🎁 ⭐ 🔔 Christmas theme
Winter ⛄ 🧣 🧤 🎿 🦌 Winter activities
Decorations 🎄 ⭐ 🔔 🧦 🕯️ Holiday decorations
Treats 🍪 🥛 🍷 Holiday treats

Advanced Usage

Customization Bottom Sheet
showCustomizationBottomSheet
(
context: context,
config: currentConfig,
onConfigChanged: (newConfig) {
setState(() {
config = newConfig;
});
},
);
Dynamic Configuration
class _MyHomePageState extends State<MyHomePage> {
  late SnowfallConfig _config;

  @override
  void initState() {
    super.initState();
    _config = const SnowfallConfig(
      numberOfSnowflakes: 200,
      speed: 1.0,
      customEmojis: ['❄️', '🎅', '🎄'],
    );
  }

  void _updateConfig(SnowfallConfig newConfig) {
    setState(() {
      _config = newConfig;
    });
  }

// ... rest of the implementation
}

Performance

Optimization Tips
  1. Keep numberOfSnowflakes between 100-300 for best performance
  2. Disable unnecessary effects (enableRandomOpacity, enableSnowDrift) if not needed
  3. Use basic shapes instead of emojis for better performance
  4. Adjust cleanup cycle timing based on your needs
Platform-Specific Notes
  • Web: Keep number of snowflakes lower for better performance
  • Mobile: Works well with default settings
  • Desktop: Can handle higher numbers of snowflakes

Example App

The plugin includes a complete example app. To run:

  1. Clone the repository
  2. Navigate to example directory:
cd example
  1. Run the app:
flutter run

The example app demonstrates:

  • Different preset configurations
  • Custom emoji selection
  • Animation controls
  • Bottom sheet customization
  • Preset switching

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup
  1. Fork the repository
  2. Clone your fork
  3. Create a new branch
  4. Make your changes
  5. Submit a pull request

Visitors Count

Loading

所属分类

依赖

依赖清单 1 项

  • plugin_platform_interface^2.0.2

源码仓库

使用此插件的项目