update method
This smoothly updates the camera for an amount of time dt
.
This should be called by the Game class during the update cycle.
Implementation
void update(double dt) {
final ds = speed * dt;
final shake = _shakeDelta();
_currentRelativeOffset.moveToTarget(_targetRelativeOffset, ds);
if (_targetCameraDelta != null && _currentCameraDelta != null) {
_currentCameraDelta?.moveToTarget(_targetCameraDelta!, ds);
}
_position = _target()..add(shake);
if (shaking) {
_shakeTimer -= dt;
if (_shakeTimer < 0.0) {
_shakeTimer = 0.0;
}
}
}