Animating with particles
In this section, we will show you how to create great particle effects and animate them. First, we will create a new file for storing our effects in the utils
folder, which we can use from anywhere:
- In the
utils
folder, create a new file calledeffects.dart
and open the file. - Add the following code for creating the exploding particle:
Particle explodingParticle(Vector2 origin, MaterialColor color) { double distanceToMove = 15.0; return Particle.generate( lifespan: 0.8, count: 12, generator: (i) { double angle = i * 30; double xx = origin.x + (distanceToMove * cos(angle)); double yy = origin.x + (distanceToMove * sin...