reset method

  1. @override
dynamic reset(
  1. dynamic productCurve(
    1. dynamic Function(
      1. double x
      )
    ),
  2. AnimationController animationController,
  3. Duration duration,
  4. Tween<Offset> tween,
  5. Offset current,
  6. double target,
)
override

Implementation

@override
reset(
  productCurve(Function(double x)),
  AnimationController animationController,
  Duration duration,
  Tween<Offset> tween,
  Offset current,
  double target,
) {
  double value = animationController.value;
  // value-target
  // value -0/1
  if (value < target) {
    // value-target
    // value -1
    productCurve((x) {
      return (target - value) / (1 - value) * (x - 1) + target;
    });
    animationController.duration = duration * (target - value);
    animationController.forward();
  } else {
    // value-target
    // value -0
    productCurve((x) {
      return (value - target) / value * x + target;
    });
    animationController.duration = duration * (value - target);
    animationController.reverse();
  }
}