tween method
GTween
tween({
- required double duration,
- Object? x,
- Object? y,
- Object? width,
- Object? height,
- GRect? 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.
Implementation
GTween tween({
required double duration,
Object? x,
Object? y,
Object? width,
Object? height,
GRect? 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 || width != null || height != null) &&
to != null) {
throw "GTween Can't use 'x, y, width, height' AND 'to' arguments to "
"tween a [GxRect]. Choose one";
}
x = to?.x ?? x;
y = to?.y ?? y;
width = to?.width ?? width;
height = to?.height ?? height;
final targetMap = {
if (x != null) 'x': x,
if (y != null) 'y': y,
if (width != null) 'width': width,
if (height != null) 'height': height,
};
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,
),
);
}