Skip to content

tween

tween<C>(game, e, component, to, options?): () => void

Animates numeric fields of one entity’s component to target values: tween(game, e, Position, { y: 100 }, { duration: 0.5, ease: ease.out }). Starts from the current values, stops by itself when done or when the entity loses the component, and returns a function that cancels it. Inside a scene it ends with the scene. Fields are interpolated as plain numbers, so use mixColor for Sprite.tint.

C extends Component

Game

number

C

Values<C>

TweenOptions

() => void