vael-ui v0.5.7

Motion guide · 6 of 8

Callbacks

Each of these runs once a motion has played, so your next step never guesses a duration. When nothing plays, as with motion off, they run at once.

Once it's in, once it's gone onAfterEnteronAfterLeaveonStart

On v-animate, onAfterEnter runs once its entrance has played, and after each replay. onAfterLeave runs once its exit has played and it's gone. Both get the element. onStart runs as the entrance starts moving, after any delay.

After a state

A state's onAfterEnter runs once it has turned on and played, with the parts by name: ({ root }) => …. Its onAfterLeave runs once it has turned off and settled back. A repeated part, such as OtpInput's cells, comes as an array.

After it opens and closes

A component's own onAfterEnter and onAfterLeave run when its @after-enter and @after-leave do, with its parts. Your elements inside take theirs in targets, beside their looks: hint: { after: 'panel', onAfterEnter }.

After a swap onAfterSwap

onAfterSwap runs once the new view is in, with that view and the direction. Calendar's runs once a new month is in, with its grid.

Each item in a list

In a list, onAfterEnter and onAfterLeave run for each item, with its parts and its index among the items that came or went together.

After a move onAfterMove

onAfterMove runs once a layout or layoutId slide, or a change of animate, has played. Each element runs its own, so a shuffle that moves four rows runs it four times.

Each repeat onRepeat

Beside a value's repeat, onRepeat runs as each repeat starts, with how many runs it has finished: 1 as the second starts, then 2.

Your own animation reducedMotion

Give an element enter or leave to animate it with GSAP or motion instead of its values. Return the animation: vael-ui waits for it before the callbacks, and stops it if the element leaves first. The hook gets the element and { signal, reducedMotion, index }. Under reduced motion your hooks don't run. Set reducedMotion: 'run' to run them anyway, and check reducedMotion in the context to drop movement.