This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Just a container for parameters | |
/// allowing to draw a circle on a [Canvas] later | |
class CircleParameters { | |
double radius; | |
Offset offset; | |
CircleParameters({@required this.radius, @required this.offset}); | |
} | |
/// Renders certain amount of circles on a [Canvas], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FadingCircle extends Particle with Fading { | |
final double radius; | |
final Color color; | |
FadingCircle({ | |
this.radius = 10, | |
this.color = Colors.white, | |
}); | |
@override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// A function which returns [Particle] when called | |
typedef ParticleProvider = Particle Function(int i); | |
/// A [CompositeParticle] which allows to use [ParticleProvider] | |
/// generator functions as source for children particles | |
/// | |
/// ```dart | |
/// // 10 plain fading circles | |
/// ParticleGenerator(10, (i) => FadingCircle()); | |
/// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In OutlineButton.build > Particles > Aligned | |
// ... | |
child: Burst( | |
children: List<Particle>.generate( | |
20, | |
(i) => ScalingParticle( | |
child: FadingCircle(radius: Randoms.rnd.nextDouble() * 8 + 2), | |
from: .2, | |
to: 1.5, | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in Burst constructor, children.map(...) | |
// ... | |
(particle) => CurvedParticle( | |
curve: Interval( | |
// Interval would start at random point from 0 to 0.5 | |
// and finish at random point between 0.6 and 1.0 | |
Randoms.rnd.nextDouble() * .5, | |
Randoms.rnd.nextDouble() * .4 + .6, | |
), | |
child: MovingParticle( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CurvedParticle extends Particle with NestedParticle, Curved { | |
Curve curve; | |
Particle child; | |
CurvedParticle({ | |
@required this.curve, | |
@required this.child, | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CurvedParticle extends Particle with NestedParticle, Curved { | |
Curve curve; | |
Particle child; | |
CurvedParticle({ | |
@required this.curve, | |
@required this.child, | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mixin Curved on Updatable { | |
Curve curve; | |
@override | |
void update(Animation animation) { | |
super.update( | |
CurveTween(curve: curve).animate(animation), | |
); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Particles extends StatefulWidget { | |
final Duration duration; | |
final Particle particle; | |
final ParticlesWidgetBuilder builder; | |
// New property you defined to make animation | |
// easing configurable from outside | |
final Curve curve; | |
const Particles({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In OutlineButton.build > Particles > Aligned > FadingCircle | |
// ... | |
radius: Randoms.rnd.nextDouble() * 10 | |
// ... |