generateTweenFlipSystem

View sourcegenerateTweenFlipSystem<T>(tween: typeof Tween): SystemFunc

Creates a system that swaps the endpoints of concrete tweens marked with TweenFlip.

The returned system queries for the supplied concrete Tween constructor and the flip marker. When a matching tween has timeTaken >= duration, it swaps the from and to references. It leaves timeTaken unchanged and does not inspect the tween’s flip boolean. If the value remains at or beyond the duration, the endpoints are swapped again the next time the system runs; combine it with TweenRepeat when each new direction should start at time 0.

Examples

const flipSystem = generateTweenFlipSystem(Position2DTween)
flipSystem(world) // swaps endpoints on matching completed tweens

Type Parameters

T

Parameters

NameDescriptionDefault
tween

Concrete tween constructor to query.

—

Returns

World system that swaps completed marked tweens.