animateTo method

void animateTo({
  1. bool? loop,
  2. double? toX,
  3. double? toY,
  4. double? toOpacity,
  5. double? toRoundedRadius,
  6. Color? toColor,
  7. double? toScale,
  8. double? toDegrees,
  9. Curve? moveXCurve,
  10. Curve? moveYCurve,
  11. Curve? scaleCurve,
  12. Curve? opacityCurve,
  13. Curve? rotateCurve,
  14. Curve? colorChangeCurve,
})

animateTo for start new animation from last animations value loop for repeat animation toX and toY for move toOpacity for opacity toScale for scale toDegrees for rotate in a clockwise direction and these animations curves is moveXCurve, moveYCurve, scaleCurve, opacityCurve, rotateCurve and colorChangeCurve enjoy it

Implementation

void animateTo({
  bool? loop,
  double? toX,
  double? toY,
  double? toOpacity,
  double? toRoundedRadius,
  Color? toColor,
  double? toScale,
  double? toDegrees,
  Curve? moveXCurve,
  Curve? moveYCurve,
  Curve? scaleCurve,
  Curve? opacityCurve,
  Curve? rotateCurve,
  Curve? colorChangeCurve,
}) {
  this.loop = loop ?? false;
  moveX = Tween<double>(begin: moveX!.value, end: toX ?? moveX!.value)
      .animate(moveXCurve == null
          ? _animationController!
          : CurvedAnimation(
              parent: _animationController!,
              curve: moveXCurve,
            ));
  moveY = Tween<double>(begin: moveY!.value, end: toY ?? moveY!.value)
      .animate(moveXCurve == null
          ? _animationController!
          : CurvedAnimation(
              parent: _animationController!,
              curve: moveXCurve,
            ));
  scale = Tween<double>(begin: scale!.value, end: toScale ?? scale!.value)
      .animate(scaleCurve == null
          ? _animationController!
          : CurvedAnimation(
              parent: _animationController!,
              curve: scaleCurve,
            ));
  rotate =
      Tween<double>(begin: rotate?.value, end: toDegrees ?? rotate?.value)
          .animate(rotateCurve == null
              ? _animationController!
              : CurvedAnimation(
                  parent: _animationController!,
                  curve: rotateCurve,
                ));
  color = ColorTween(
          begin: color?.value ?? Colors.transparent,
          end: toColor ?? color?.value)
      .animate(colorChangeCurve == null
          ? _animationController!
          : CurvedAnimation(
              parent: _animationController!,
              curve: colorChangeCurve,
            ));
  opacity =
      Tween<double>(begin: opacity!.value, end: toOpacity ?? opacity!.value)
          .animate(opacityCurve == null
              ? _animationController!
              : CurvedAnimation(
                  parent: _animationController!,
                  curve: opacityCurve,
                ));
  radius = Tween<double>(
          begin: radius?.value ?? 2,
          end: toRoundedRadius ?? radius?.value ?? 2)
      .animate(_animationController!);
  progress =
      Tween<double>(begin: 0.0, end: 1.0).animate(_animationController!);
  _animationController!.value = 0;
}