BouncingParticle.random constructor
BouncingParticle.random(
- Size area
Implementation
factory BouncingParticle.random(Size area) {
Vector2 velocity = randomVector(-2, 2);
Vector2 position = Vector2(area.width / 2, area.height / 2);
double radius = 25 + Random().nextDouble() * 40;
return BouncingParticle(
area: area,
basePosition: position.clone(),
position: position.clone(),
velocity: velocity,
radius: radius,
baseRadius: radius,
);
}