easeCamera method

Future<bool> easeCamera(
  1. CameraUpdate cameraUpdate, {
  2. Duration? duration,
  3. CameraAnimationInterpolation? interpolation,
})

Eases the camera to a new position with an optional duration.

The cameraUpdate specifies the target camera position, and duration specifies the animation duration (optional). A negative duration throws an ArgumentError. The interpolation parameter controls the easing curve (optional).

Use CameraAnimationInterpolation.linear for smooth continuous tracking without velocity discontinuities. This is ideal for following moving objects.

The returned Future completes when the animation ends, with true if the camera arrived and false if the movement was canceled, for example by another camera call, a gesture or the map being disposed. An update with a value that is NaN or infinite fails with a PlatformException with code INVALID_ARGUMENT.

Implementation

Future<bool> easeCamera(
  CameraUpdate cameraUpdate, {
  Duration? duration,
  CameraAnimationInterpolation? interpolation,
}) async {
  if (duration != null && duration.isNegative) {
    throw ArgumentError.value(duration, 'duration', 'must not be negative');
  }
  return _maplibrePlatform.easeCamera(
    cameraUpdate,
    duration: duration,
    interpolation: interpolation,
  );
}