README.mdMIT
tinyflip animates layout changes with the FLIP technique: measure, change the DOM, then animate the difference with a transform. It is 1.1 kB and does not know about any framework.
Usage
import { flip } from "tinyflip"
const play = flip(list.children) // first: measure
list.append(list.firstElementChild) // change the DOM any way you like
play({ duration: 320 }) // invert and play
Good to know
- Only
transformandopacityare animated, so nothing triggers layout while it runs - Elements that entered or left get a fade; pass
enterandexitto change it - With reduced motion the change is instant
It works with any renderer because the two calls sit on either side of whatever updates your DOM.
