accelerated method

Particle accelerated({
  1. required Vector2 acceleration,
  2. Vector2? position,
  3. Vector2? speed,
})

Wraps this particle with a AcceleratedParticle.

Allowing to specify desired position speed and acceleration and leave the basic physics do the rest.

Implementation

Particle accelerated({
  required Vector2 acceleration,
  Vector2? position,
  Vector2? speed,
}) {
  return AcceleratedParticle(
    position: position ?? Vector2.zero(),
    speed: speed ?? Vector2.zero(),
    acceleration: acceleration,
    child: this,
    lifespan: _lifespan,
  );
}