@fogrexon/glyph-arena-tween

Tick-driven scalar tweening for Glyph Arena. See also package README.

Exports

Generated from the package's source when the docs are built — do not edit this table by hand.

NameKind
ApproachOptionstype
Tweentype
TweenHandletype
approachfunction
createTweenfunction

createTween()

const tween = createTween();

const handle = tween.to(0, 10, 1);
const value = tween.get(handle);

tween.tick(nowSeconds);
tween.cancel(handle);
tween.dispose();

Methods

TweenHandle

number — opaque handle returned by to.

Time

All values are in seconds. Nothing advances until tick() is called.

Origin

The first tick() sets the time origin. Tweens created before that tick start at the origin.

Interpolation

In progress: from + (to - from) * ease(u) where u = clamp(elapsed / duration, 0, 1).

The return value of ease is not clamped. NaN and Infinity in from or to pass through without normalization.

Zero duration

durationSeconds === 0 completes on the next tick(); get is undefined afterward.

Negative duration

Negative durationSeconds do not start a tween. Returns a handle; get and cancel on that handle are no-ops.

Completion

After the completing tick(), get is undefined (the final value is not retained).

Error handling

If ease throws, that tween is removed; other tweens continue; the first error is rethrown after the tick finishes.

After dispose()