Skip to content

aninest-root / Animatable / modifyTo

modifyTo()

ts
function modifyTo<Animating>(
   anim, 
   to, 
   suppressListeners): void;

Defined in: Animate/Animatable.ts:211

Sets the final stopping point of the animation. The animation will start to interpolate to the new state the next time updateAnimation is called.

Type Parameters

Animating

Animating extends Animatable<unknown>

Parameters

anim

Animation<Animating>

The animation object

to

PartialRecursiveAnimatable<Animating>

The new partial state of the animation. A partial state means that if the complete state is { a: 0, b: 0 } and you call modifyTo(anim, { a: 1 }), the new target state will be { a 1, b: 0 }.

suppressListeners

ListenerSuppressor = ...

If true, the start listeners will not be called. Useful for when you want to modify the animation within a start listener without causing an infinite loop. You can also pass an object with start and interrupt keys to selectively suppress listeners. By default true suppresses the start listeners while false suppresses nothing. This means that if you want to suppress the interrupt listeners, you must pass an object with interrupt: true.

Returns

void

Examples

ts
modifyTo<{a: number, b: number}>(anim, { a: 1, b: 1 })
ts
modifyTo<{a: Vec2, b: Vec2}>(anim, {a: {x: 1}})
ts
modifyTo<{a: Vec2, b: Vec2}>(anim.children.a, {x: 1})

See

Vec2