MCPcopy
hub / github.com/4ian/GDevelop / addSimpleTween

Method addSimpleTween

Extensions/TweenBehavior/TweenManager.ts:241–274  ·  view source on GitHub ↗

* Add a tween on one value.

(
          identifier: string,
          timeSource: TimeSource,
          totalDuration: number,
          easingIdentifier: string,
          interpolate: Interpolation,
          initialValue: float,
          targetedValue: float,
          setValue: (value: float) => void,
          tweenInformation: TweenInformation,
          onFinish?: (() => void) | null
        )

Source from the content-addressed store, hash-verified

239 * Add a tween on one value.
240 */
241 addSimpleTween(
242 identifier: string,
243 timeSource: TimeSource,
244 totalDuration: number,
245 easingIdentifier: string,
246 interpolate: Interpolation,
247 initialValue: float,
248 targetedValue: float,
249 setValue: (value: float) => void,
250 tweenInformation: TweenInformation,
251 onFinish?: (() => void) | null
252 ): void {
253 const easing = easingFunctions[easingIdentifier];
254 if (!easing) return;
255
256 // Remove any prior tween
257 this.removeTween(identifier);
258
259 // Initialize the tween instance
260 const tween = new SimpleTweenInstance(
261 timeSource,
262 totalDuration,
263 easing,
264 easingIdentifier,
265 interpolate,
266 initialValue,
267 targetedValue,
268 setValue,
269 tweenInformation,
270 onFinish
271 ) as TweenInstance<number>;
272 this._tweens.set(identifier, tween);
273 this._addActiveTween(tween);
274 }
275
276 /**
277 * Add a tween on several values.

Callers 15

addVariableTweenMethod · 0.80
_addVariableTweenMethod · 0.80
addValueTweenMethod · 0.80
_addObjectAngleTweenMethod · 0.80
addObjectScaleTween3Method · 0.80
_addObjectScaleXTweenMethod · 0.80

Calls 3

removeTweenMethod · 0.95
_addActiveTweenMethod · 0.95
setMethod · 0.65

Tested by

no test coverage detected