moveAndRotateAnimatedRaw method

void moveAndRotateAnimatedRaw(
  1. LatLng newCenter,
  2. double newZoom,
  3. double newRotation, {
  4. required Offset offset,
  5. required Duration duration,
  6. required Curve curve,
  7. required bool hasGesture,
  8. required MapEventSource source,
})

Move and rotate the the map with an animation. The raw method allows to set all parameters.

Implementation

void moveAndRotateAnimatedRaw(
  LatLng newCenter,
  double newZoom,
  double newRotation, {
  required Offset offset,
  required Duration duration,
  required Curve curve,
  required bool hasGesture,
  required MapEventSource source,
}) {
  if (newRotation == camera.rotation) {
    moveAnimatedRaw(
      newCenter,
      newZoom,
      duration: duration,
      curve: curve,
      hasGesture: hasGesture,
      source: source,
    );
    return;
  }
  // cancel all ongoing animation
  _animationController.stop();
  _resetAnimations();

  if (newCenter == camera.center && newZoom == camera.zoom) return;

  // create the new animation
  _moveAnimation = LatLngTween(begin: camera.center, end: newCenter)
      .chain(CurveTween(curve: curve))
      .animate(_animationController);
  _zoomAnimation = Tween<double>(begin: camera.zoom, end: newZoom)
      .chain(CurveTween(curve: curve))
      .animate(_animationController);
  _rotationAnimation = Tween<double>(begin: camera.rotation, end: newRotation)
      .chain(CurveTween(curve: curve))
      .animate(_animationController);

  _animationController.duration = duration;
  _animationHasGesture = hasGesture;
  _animationOffset = offset;

  // start the animation from its start
  _animationController.forward(from: 0);
}