Skip to content

Animate

import { flip } from "solivelte";

flip

The flip function calculates the start and end position of an element and animates between them, translating the x and y values. flip stands for First, Last, Invert, Play.

function flip(
node: Element,
{ from, to }: { from: DOMRect; to: DOMRect },
params?: FlipParams
): AnimationConfig;

AnimationConfig

interface AnimationConfig {…}
delay?: number;
duration?: number;
easing?: (t: number) => number;
css?: (t: number, u: number) => string;
tick?: (t: number, u: number) => void;

FlipParams

interface FlipParams {…}
delay?: number;
duration?: number | ((len: number) => number);
easing?: (t: number) => number;