API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classTweenSystem

@codexo/exojs / animation / stable

Owns and advances a collection of Tween instances, driving them once per frame from Application.update. A tween enters the update list when Tween.start is called and leaves it again on completion or Tween.stop, so the system only ever holds tweens that are running or paused - regardless of whether it was created here or handed over via TweenSystem.add. Custom updatables (such as TweenSequencer) can be registered via TweenSystem.addTicker so they share the same frame tick. Update iteration uses a snapshot so callbacks may freely add or remove tweens during the same frame without corrupting the loop. Completed and stopped tweens are evicted automatically.

0
props
10
methods
0
events
Import
import { TweenSystem } from '@codexo/exojs'

Owns and advances a collection of Tween instances, driving them once per frame from Application.update. A tween enters the update list when Tween.start is called and leaves it again on completion or Tween.stop, so the system only ever holds tweens that are running or paused - regardless of whether it was created here or handed over via TweenSystem.add.

Custom updatables (such as TweenSequencer) can be registered via TweenSystem.addTicker so they share the same frame tick.

Update iteration uses a snapshot so callbacks may freely add or remove tweens during the same frame without corrupting the loop. Completed and stopped tweens are evicted automatically.

Constructors1
new(): TweenSystem
Methods10
Take ownership of a stand-alone Tween (created via new Tween(target), or previously bound to a different system) so it participates in this update loop: from here on, Tween.start enters it and completion or Tween.stop evicts it again. Binding and entering are two separate steps. A tween that is already running or paused is live - nothing will call start() on it again to enter it - so it goes into the update list right away. An idle, completed or stopped tween is bound only: retaining it would pin it, and through it its target, in this system for the lifetime of the application while the update loop has nothing to do with it.
Register a custom updatable so it is driven each frame alongside tweens. Idempotent - registering the same ticker twice is a no-op. Used internally by TweenSequencer.
clear(): this
Remove all tweens and tickers immediately. No callbacks fire. Each tracked tween is Tween.stopped first, and so is every ticker that can be stopped, so their state reflects the eviction instead of staying Active/Paused on something the system no longer drives - a Stopped tween's own system binding survives, so a later Tween.start re-enters it as usual.
Create a new Tween bound to this system and return it. Call .to(...).start() on the result to begin animating. The tween is only entered into the update list by Tween.start - a tween that is configured but never started is not retained here, so it cannot keep its target alive for the lifetime of the application.
Create a new TweenSequencer bound to this system and return it. The sequencer registers itself automatically when TweenSequencer.start is called, so no manual wiring is needed.
destroy(): void
Tear down the system. Clears tweens and tickers and makes subsequent updates no-ops.
Advance all active tweens by the frame delta (read as seconds), then advance all registered tickers. The SystemMethods.preFrame phase, at SystemOrder.CoreTweens. Uses snapshots so callbacks that add or remove tweens/tickers do not corrupt mid-iteration.
Remove a previously registered ticker. Called automatically by TweenSequencer when it completes or is stopped.
Chain tweens in sequence: each tween starts automatically when the previous one completes. Returns the first tween; call .start() on it to kick off the whole sequence. All tweens are bound to this system, but only enter the update list when they are actually started - the first through your own .start() call, every later one through the chain. A sequence that is composed and never started therefore leaves nothing behind here.
Source