Skip to content

IGSAPPlugin

Defined in: plugins/GSAPPlugin.ts:20

Interface for the GSAPPlugin, defining its public API for high-performance animations. Provides comprehensive GSAP integration with custom animation context management.

readonly anim: typeof gsap

Defined in: plugins/GSAPPlugin.ts:37

The GSAP instance for creating animations.


app: IApplication

Defined in: plugins/Plugin.ts:10

IPlugin.app


readonly easeNames: string[]

Defined in: plugins/GSAPPlugin.ts:25

Array of all registered custom ease names.


readonly eases: Record<string, gsap.EaseFunction>

Defined in: plugins/GSAPPlugin.ts:31

Object containing all registered custom eases, where keys are ease names and values are GSAP ease functions.


id: string

Defined in: plugins/Plugin.ts:8

IPlugin.id


readonly options: Partial<O>

Defined in: plugins/Plugin.ts:12

IPlugin.options

addAnimation(animation, contextId?): Timeline | Tween | (Timeline | Tween)[]

Defined in: plugins/GSAPPlugin.ts:62

Adds one or more GSAP tweens or timelines to a specified animation context. Animation contexts are custom collections (Set) of tweens/timelines managed by this plugin, NOT gsap.Context instances. If no contextId is provided, animations are added to the global context.

A single GSAP tween/timeline or an array of them

Timeline | Tween | (Timeline | Tween)[]

string

Optional ID of the custom animation context. Defaults to the global context

Timeline | Tween | (Timeline | Tween)[]

The animation(s) that were added

// Add single animation to specific context
const tween = gsap.to(mySprite, { x: 100, duration: 1 });
gsapPlugin.addAnimation(tween, 'gameplayAnimations');
// Add multiple animations to global context
const tweens = [
gsap.to(sprite1, { alpha: 0.5, duration: 1 }),
gsap.to(sprite2, { rotation: Math.PI, duration: 2 })
];
gsapPlugin.addAnimation(tweens);

addSignalConnection(…args): void

Defined in: plugins/Plugin.ts:20

SignalConnection[]

void

IPlugin.addSignalConnection


clear(contextId): void

Defined in: plugins/GSAPPlugin.ts:200

Clears (removes) a specific custom animation context and its tracked animations. If this results in no active contexts, the global collection is recreated if all contexts are cleared.

string

The ID of the animation context to clear

void

// Clean up completed level animations
gsapPlugin.clear('level1Animations');

clearAll(): void

Defined in: plugins/GSAPPlugin.ts:211

Clears all custom animation contexts and recreates the plugin’s global animation collection.

void

// Complete reset when restarting the game
gsapPlugin.clearAll();

clearGlobal(): void

Defined in: plugins/GSAPPlugin.ts:244

Clears all animations from the global animation collection managed by this plugin.

void

// Clear global animations for cleanup
gsapPlugin.clearGlobal();

clearSignalConnections(): void

Defined in: plugins/Plugin.ts:22

void

IPlugin.clearSignalConnections


destroy(): void

Defined in: plugins/Plugin.ts:18

void

IPlugin.destroy


getContext(contextId): null | Set<Timeline | Tween>

Defined in: plugins/GSAPPlugin.ts:121

Retrieves a custom animation context (a Set of tweens/timelines) by its ID. This is NOT a gsap.Context instance but rather a custom collection for grouping animations.

string

The ID of the animation context

null | Set<Timeline | Tween>

The animation context (a Set of tweens/timelines) or null if not found

const menuAnimations = gsapPlugin.getContext('menuAnimations');
if (menuAnimations) {
console.log(`Menu has ${menuAnimations.size} active animations`);
}

initialize(options, app): void | Promise<void>

Defined in: plugins/Plugin.ts:14

Partial<O>

IApplication

void | Promise<void>

IPlugin.initialize


killAll(contextId?): void

Defined in: plugins/GSAPPlugin.ts:170

Kills (stops and removes) all animations in a specified custom animation context, or all animations. If all contexts are killed, the plugin’s global animation collection is recreated.

string

Optional ID of the animation context. If omitted, kills all animations

void

// Kill specific context when transitioning scenes
gsapPlugin.killAll('oldSceneAnimations');
// Emergency stop all animations
gsapPlugin.killAll();

killGlobal(): void

Defined in: plugins/GSAPPlugin.ts:222

Kills all animations within the global animation collection managed by this plugin.

void

// Stop only global animations, keep context-specific ones
gsapPlugin.killGlobal();

pauseAll(contextId?): void

Defined in: plugins/GSAPPlugin.ts:153

Pauses all animations in a specified custom animation context, or all animations in all contexts.

string

Optional ID of the animation context. If omitted, pauses all animations

void

// Pause game animations when menu opens
gsapPlugin.pauseAll('gameplayAnimations');
// Pause everything when app loses focus
gsapPlugin.pauseAll();

playAll(contextId?): void

Defined in: plugins/GSAPPlugin.ts:137

Plays all animations in a specified custom animation context, or all animations in all contexts.

string

Optional ID of the animation context. If omitted, plays all animations

void

// Play all animations in a specific context
gsapPlugin.playAll('gameplayAnimations');
// Play all animations in all contexts
gsapPlugin.playAll();

postInitialize(_app): void | Promise<void>

Defined in: plugins/Plugin.ts:16

IApplication

void | Promise<void>

IPlugin.postInitialize


registerCoreFunctions(): void

Defined in: plugins/Plugin.ts:24

void

IPlugin.registerCoreFunctions


registerCoreSignals(): void

Defined in: plugins/Plugin.ts:26

void

IPlugin.registerCoreSignals


registerCustomEase(name, ease): Ease

Defined in: plugins/GSAPPlugin.ts:87

Registers a custom ease function with GSAP.

string

The name of the custom ease

EaseFunction

The GSAP ease function

Ease

An object containing the registered ease

// Register a custom bounce ease
gsapPlugin.registerCustomEase('myBounce', (progress) => {
return progress < 0.5
? 2 * progress * progress
: 1 - Math.pow(-2 * progress + 2, 3) / 2;
});
// Use the custom ease in animations
gsap.to(mySprite, { x: 200, duration: 1, ease: 'myBounce' });

registerEases(eases): Ease

Defined in: plugins/GSAPPlugin.ts:104

Registers multiple custom ease functions with GSAP in batch.

Record<string, gsap.EaseFunction>

An object where keys are ease names and values are GSAP ease functions

Ease

The complete map of registered eases

gsapPlugin.registerEases({
'softBounce': (t) => t * t * (3 - 2 * t),
'sharpEase': (t) => t * t * t,
'customBack': (t) => t * t * (2.7 * t - 1.7)
});

revertAll(contextId?): void

Defined in: plugins/GSAPPlugin.ts:186

Reverts all animations in a specified custom animation context to their initial state.

string

Optional ID of the animation context. If omitted, reverts all animations

void

// Reset UI animations to initial state
gsapPlugin.revertAll('uiAnimations');
// Reset everything for game restart
gsapPlugin.revertAll();

revertGlobal(): void

Defined in: plugins/GSAPPlugin.ts:233

Reverts all animations within the global animation collection to their initial state.

void

// Reset global animations without affecting contexts
gsapPlugin.revertGlobal();