tween method
GTween
tween({
- required double duration,
- Object? x,
- Object? y,
- GPoint? to,
- EaseFunction? ease,
- double? delay,
- bool? useFrames,
- int? overwrite,
- VoidCallback? onStart,
- Object? onStartParams,
- VoidCallback? onComplete,
- Object? onCompleteParams,
- VoidCallback? onUpdate,
- Object? onUpdateParams,
- bool? runBackwards,
- bool? immediateRender,
- Map? startAt,
Creates a GTween animation for this object.
The animation can target the 'x' and 'y' properties. You can pass the values for the properties either as separate x and y arguments, or as a single GPoint object in the to argument. You can also specify the duration, easing function, delay, and other parameters for the animation.
If you pass values for both x
and y
arguments and the to
argument,
an exception will be thrown. Choose one method to set the values.
Returns the created GTween object.
Implementation
GTween tween({
required double duration,
Object? x,
Object? y,
GPoint? to,
EaseFunction? ease,
double? delay,
bool? useFrames,
int? overwrite,
VoidCallback? onStart,
Object? onStartParams,
VoidCallback? onComplete,
Object? onCompleteParams,
VoidCallback? onUpdate,
Object? onUpdateParams,
bool? runBackwards,
bool? immediateRender,
Map? startAt,
}) {
if ((x != null || y != null) && to != null) {
throw '''
GTween Can't use 'x, y' AND 'to' arguments for GxPoint tween. Choose one''';
}
x = to?.x ?? x;
y = to?.y ?? y;
final targetMap = {
if (x != null) 'x': x,
if (y != null) 'y': y,
};
return GTween.to(
this,
duration,
targetMap,
GVars(
ease: ease,
delay: delay,
useFrames: useFrames,
overwrite: overwrite,
onStart: onStart,
onStartParams: onStartParams,
onComplete: onComplete,
onCompleteParams: onCompleteParams,
onUpdate: onUpdate,
onUpdateParams: onUpdateParams,
runBackwards: runBackwards,
immediateRender: immediateRender,
startAt: startAt,
),
);
}