flutter_floating_particles 2.0.0
flutter_floating_particles: ^2.0.0 copied to clipboard
Animated particle effects for Flutter. Snow, rain, confetti, fireworks, hearts and more, with emitters, bursts, physics, touch interaction, images, SVGs and widgets.
2.0.0 #
Breaking changes #
ParticlePainteris no longer exported. UseParticleEffects, which can now be used without a child as a standalone layer.ParticleTypegainsstreak,path,snowflake,sparkle,petal,raindrop,ring,triangleanddiamond.ParticleDirectiongainsnoneandradial, andParticleEffectTypegains the new presets. Exhaustiveswitchstatements over these enums need the new cases.velocityMultiplier,enableSizeVariation,onAnimationCompleteandloadingWidgetpreviously had no effect and now work, so effects that set them look or behave differently.- Glow now adds a halo around a sharp particle instead of blurring the whole particle. Use
enableBlurfor a soft look. - The
rainpreset now uses the newstreakshape, and thesnowpreset uses slowly spinningsnowflakes (sized 4–12 instead of 2–8).fireAshesand the newfirefliespreset use additive blending. - Custom widget particles are rendered once at
maxSizeand scaled per particle, instead of being laid out at each particle's size. ParticleCoveragemoved toparticle_coverage.dart(it is still exported from the main library) and gained afractiongetter.- Requires Flutter 3.32 or later.
Performance #
- All particles are drawn from pre-rendered sprites, packed into one atlas, in a single
drawRawAtlascall, with glow and blur baked into the sprite instead of being applied to every particle on every frame. - Animation runs on a
Tickerthat repaints the painter directly: no widget rebuilds, noDateTime.now()per particle, and no per-particle allocations. - The ticker stops while the effect is disabled, paused, frozen for reduced motion, or has nothing to animate.
adaptiveQualitydraws fewer particles while frames miss their budget, andParticleConfig.maxParticlescaps the number of particles drawn at once.- Removed the
httpandvector_mathdependencies. Images load through Flutter'sImageProviders (with Flutter's image cache and web support), and SVGs throughflutter_svg's loaders.
New features #
ParticleControllerto pause, resume andburst()particles, with gravity, drag, spread, direction and lifespan.ParticleInteraction: particles move away from or toward the pointer, or burst on tap, without blocking the child.layer: ParticleLayer.backgroundto paint particles behind the child.- The child is now optional, so the widget can be used as a standalone particle layer.
respectReduceMotion(default true) freezes particles when the platform asks for reduced motion.clipBehaviorkeeps particles within the widget's bounds.ParticleType.streakfor rain, andParticleType.pathwithcustomPathfor any custom shape.ParticleDirection.none(wandering in place) andParticleDirection.radial(flying outward from the center).ParticleConfig.imageaccepts anyImageProvider.- New
ParticleConfigoptions:seed,wind,driftAmplitude,edgeFade,blendModeandrotationSpeed. ParticleConfig.copyWith, and asserts for invalid configurations.- New
firefliesandstarfieldpresets.ParticleEffectType.configreturns the preset for each effect type. ParticleEffects.preloadImageProvider.- Emitters (
ParticleConfig.emitters) that continuously spawn particles from a point, area or moving widget, with fountain, smoke and fireworks presets. - Controller presets:
explode,confettiCannon,fireworks(shells that rise and explode), andburstFromKeyto burst out of any widget. ParticleLifecycle: size, opacity and color over each particle's life.ParticleTrail: fading tails behind particles.ParticleSplash: rain splashes where particles reach the end of their path.ParticleConnections: lines between nearby particles and the pointer.depthEffect: small particles move slower and look fainter, like they're farther away.parallaxandScrollParallax: particles shift with scrolling (or tilt).colliders: particles pile up on and bounce off widgets.- Mixing several particle types (
particleTypes) or images (images) in one effect. - Seven new shapes: snowflake, sparkle, petal, raindrop, ring, triangle and diamond.
ParticleInteraction.popOnTapandonParticleTapto pop tapped particles, andemitOnDragto paint particles with a finger.ParticleController.timeScale(slow motion),seekandreset.ParticleConfig.toJsonandParticleConfig.fromJson.fromJsonaccepts hand-written and partial JSON: values of the wrong type use their defaults and out-of-range values are clamped, so any JSON object gives a valid configuration.- The example Playground can import JSON as well as export it.
- New presets:
fireworks,sakura,networkandblizzard.
Bug fixes #
- Fixed failed image loads (e.g. a 404 URL) being retried on every frame.
- Fixed
ParticleConfigequality ignoringgradientColors, so color-only changes now regenerate particles. - Fixed different custom widgets of the same type sharing one cached image, and custom widget snapshots being blurry on high-density screens.
- Fixed
setStatebeing called after dispose while images were loading. - Fixed particles vanishing mid-screen and snapping at cycle boundaries. Particles now enter and leave off-screen (or fade out with partial
particleCoverage), anddiagonalparticles are spread across the screen. - Fixed cached images, codecs, SVG pictures and offscreen render trees not being disposed.
- Fixed SVG decoding of non-ASCII content and stretching of non-square SVGs.
- Changing
animationDurationno longer makes particles jump. - Popped (or collided) particles that wander in place (
ParticleDirection.none) now come back after a cycle instead of staying hidden forever. - Streak particles now point along their motion even when mixed with other types in
particleTypes. - Fixed square outlines and stray lines around particles on Impeller's OpenGL ES backend (most Android devices).
- Fixed custom widget particles failing with "Invalid image dimensions" when created while the app starts (e.g. on Android).
1.0.2 #
- Significant performance optimization for low-end devices:
- Implemented RepaintBoundary for GPU-accelerated animation layering.
- Optimized rendering of complex shapes with cached paths.
- Added new
ParticleType.leaffor realistic falling leaves effect. - Added support for network images in
ParticleType.image. Support both HTTP/HTTPS URLs. - Added support for SVG images (both local assets and network URLs) via
flutter_svg.
1.0.1 #
- Fixed Dart analysis warnings and lints across the package and example.
- Improved performance by using
constconstructors where applicable. - Updated deprecated API usage for better compatibility with recent Flutter versions.
- Improved unit test robustness by disabling debug banners during testing.
1.0.0 #
- initial draft of the Flutter Floating particles.