MotionTween<T> constructor
MotionTween<T> ({
- required SetterCallback<
T> setter, - required T start,
- required T end,
- required double duration,
- Curve? curve,
Creates a new tween motion. The setter will be called to update the
animated property from start to end over the duration
time in
seconds. Optionally an animation curve
can be passed in for easing the
animation.
// Animate myNode from its current position to 100.0, 100.0 during
// 1.0 second and a bounceOut easing
var myTween = MotionTween(
setter: (a) => myNode.position = a,
start: myNode.position,
end: new Point(100.0, 100.0,
duration: 1.0,
curve: Curves.bounceOut,
);
myNode.motions.run(myTween);
Implementation
MotionTween({
required this.setter,
required this.start,
required this.end,
required double duration,
Curve? curve,
}) : super(duration, curve) {
_computeDelta();
}