Svelte Transitions
Written
— Updated
- Useful Transitions
- Slide in from the side
- Slide in from the side
- Deferred Transitions
- These can be useful for more advanced cases.
- They feel complicated, but basically your transition function does some initialization and then returns another function.
- Svelte will call that function only once all other elements starting a transition at the same time have run their initialization.
- This lets you set up some shared state between multiple transitioning elements.
- Important caveat: Elements that are transitioning but not in the same component may not always transition on the same tick.
crossfade
is the deferred transition that comes with the Svelte library.- svelte-zoomable uses these extensively to coordinate multiple elements.