moveToPositionAnimated method

void moveToPositionAnimated({
  1. required Vector2 position,
  2. EffectController? effectController,
  3. double? zoom,
  4. double? angle,
  5. dynamic onComplete()?,
})

Implementation

void moveToPositionAnimated({
  required Vector2 position,
  EffectController? effectController,
  double? zoom,
  double? angle,
  Function()? onComplete,
}) {
  stop();
  var controller = effectController ?? EffectController(duration: 1);
  final moveToEffect = MoveToEffect(
    position,
    controller,
    onComplete: onComplete,
  );
  viewfinder.add(moveToEffect);
  if (zoom != null) {
    final zoomEffect = ScaleEffect.to(
      Vector2.all(zoom),
      controller,
    );
    zoomEffect.removeOnFinish = true;
    viewfinder.add(zoomEffect);
  }
  if (angle != null) {
    final rotateEffect = RotateEffect.to(
      angle,
      controller,
    );
    rotateEffect.removeOnFinish = true;
    viewfinder.add(rotateEffect);
  }
}