RotatingParticle.random constructor
RotatingParticle.random(
- Size area
Implementation
factory RotatingParticle.random(Size area) {
Vector2 velocity = randomVector(-2, 2);
// change this for more strange effect
final minRadius = min(area.width, area.height) * 0.1;
// change this for more strange effect
final minPosition = min(area.width, area.height) * 0.2;
Vector2 position = Vector2(area.width / 2, area.height / 2) +
Vector2(randomDouble(-minPosition, minPosition),
randomDouble(-minPosition, minPosition));
double radius = minRadius + Random().nextDouble() * minRadius;
return RotatingParticle(
area: area,
center: Vector2(area.width / 2, area.height / 2),
basePosition: position.clone(),
position: position.clone(),
velocity: velocity,
radius: radius,
baseRadius: radius,
angle: 0,
angleVelocity: 0,
angleAcceleration: 0.05,
);
}