crossfade function creates a pair of transitions called send and receive. When an element is ‘sent’, it looks for a corresponding element being ‘received’, and generates a transition that transforms the element to its counterpart’s position and fades it out. When an element is ‘received’, the reverse happens. If there is no counterpart, the fallback transition is used.
This is useful for creating smooth transitions between lists, such as a todo list where items move between “active” and “completed” states.
Usage
Parameters
Thecrossfade function accepts a configuration object with the following parameters:
Milliseconds before starting the transition
Duration of the transition in milliseconds, or a function that takes the distance (in pixels) between the two elements and returns a duration
An easing function that controls the animation curve
A transition to use when there is no matching element. Receives
(node, params, intro) and should return a TransitionConfigReturn value
Thecrossfade function returns a tuple [send, receive] containing two transition functions. Each transition function is used with the in: and out: directives and requires a key parameter to match corresponding elements: