update method

void update(
  1. double dt
)

Updates position of the bubble rising upwards with subtle sine wave horizontal wobble.

Implementation

void update(double dt) {
  wobbleTime += dt * driftFrequency;
  final double driftX = sin(wobbleTime) * driftAmplitude * dt * 35.0;
  position = Offset(
    position.dx + driftX,
    position.dy - speed * dt,
  );
}