tween method

GTween tween({
  1. required double duration,
  2. Object? x,
  3. Object? y,
  4. Object? width,
  5. Object? height,
  6. GRect? to,
  7. EaseFunction? ease,
  8. double? delay,
  9. bool? useFrames,
  10. int? overwrite,
  11. VoidCallback? onStart,
  12. Object? onStartParams,
  13. VoidCallback? onComplete,
  14. Object? onCompleteParams,
  15. VoidCallback? onUpdate,
  16. Object? onUpdateParams,
  17. bool? runBackwards,
  18. bool? immediateRender,
  19. 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,
    ),
  );
}