tween method

GTween tween(
  1. Map targetMap, {
  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 target Map to a specified targetMap.

The tween will animate the values of the value map to the corresponding values in the targetMap. The parameters are the same as the ones in the GTween.to method.

Throws an error if the targetMap is empty or if there are no matching keys with the tweenable target.

Implementation

GTween tween(
  Map targetMap, {
  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,
}) {
  targetMap.removeWhere((k, v) => !value.containsKey(k));
  if (targetMap.isEmpty) {
    throw '''
tween(targetMap) Map can't be empty. Or there are no matching keys with the tweenable target.''';
  }

  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,
    ),
  );
}