animateTo method

void animateTo(
  1. Matrix4 target, {
  2. Duration duration = const Duration(milliseconds: 350),
  3. Curve curve = Curves.easeInOut,
})

Implementation

void animateTo(
  Matrix4 target, {
  Duration duration = const Duration(milliseconds: 350),
  Curve curve = Curves.easeInOut,
}) {
  if (_vsync == null) {
    transform = target;
    return;
  }

  _animationController?.stop();
  _animationController ??= AnimationController(vsync: _vsync!)
    ..addListener(_onAnimate);
  _animationController!.duration = duration;

  _animation = Matrix4Tween(
    begin: _transform,
    end: target,
  ).animate(CurvedAnimation(parent: _animationController!, curve: curve));

  _animationController!
    ..reset()
    ..forward();
}