onAnimate method

  1. @protected
void onAnimate()

Handle inertia drag animation.

Implementation

@protected
void onAnimate() {
  if (!controller.isAnimating) {
    currentAxis = null;
    animation?.removeListener(onAnimate);
    animation = null;
    controller.reset();
    afterAnimate();
    return;
  }
  // Translate such that the resulting translation is _animation.value.
  final Vector3 translationVector =
      transformationController!.value.getTranslation();
  final Offset translation = Offset(translationVector.x, translationVector.y);
  final Offset translationScene = transformationController!.toScene(
    translation,
  );
  final Offset animationScene = transformationController!.toScene(
    animation!.value,
  );
  final Offset translationChangeScene = animationScene - translationScene;
  transformationController!.value = matrixTranslate(
    transformationController!.value,
    translationChangeScene,
  );
}