tween method

GTween tween(
  1. List targetList, {
  2. required double duration,
  3. EaseFunction? ease,
  4. double? delay,
  5. bool? useFrames,
  6. int? overwrite,
  7. VoidCallback? onStart,
  8. Object? onStartParams,
  9. VoidCallback? onComplete,
  10. Object? onCompleteParams,
  11. VoidCallback? onUpdate,
  12. Object? onUpdateParams,
  13. bool? runBackwards,
  14. bool? immediateRender,
  15. Map? startAt,
})

Tweens the values in this list to the specified target values.

The targetList argument should be a list of numeric values that has the same length as the list of values in this instance of GTweenableList.

Returns a GTween instance that represents the tween animation.

Implementation

GTween tween(
  List targetList, {
  required double duration,
  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,
}) {
  targetList.removeWhere((element) => element is! num);
  if (targetList.isEmpty) {
    throw '''
tween(targetList) List can't be empty. Or values inside of it where not a number type''';
  }
  final targetMap = {};
  for (var i = 0; i < targetList.length; ++i) {
    targetMap[i] = targetList[i];
  }
  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,
      ));
}