03.12 · Page Transitions
FLIP Technique
Cards glide to their new places when the layout changes. Best for sorting lists.
Click it
Click a button above the cards, or press Show me.
Inside, dashed boxes show where each card was: it jumped to its new place, was shifted back, then glides along the arrow. Click a button above the cards, or press Show me.
Jumps moves every card to its new place at once; Glides moves each one there smoothly from where it was. Click a button above the cards, or press Show me.
Try it
Change a setting, then try it again or press Show me.
Speed
How long the cards take to glide into place.
Feel
Springy goes a little past each place, then settles.
Copy the prompt
Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.
Animate layout changes in [the grid or list you want to rearrange] with the FLIP technique. Before the change, record where every item is. Apply the new order or layout so the items jump to their new places. Then shift each item back to where it was with a transform, and animate that shift away so the items glide to their real places. Only transforms animate, so it stays smooth even with many items. Match items across the change by a stable id. If the visitor has reduced motion turned on, let the items jump to their new places without gliding. Match the settings listed below.
Your settings
Replace the words in brackets with your own element. Your settings are added at the end.
Free and open source. If this helped, a star on GitHub helps other people find it.
Star on GitHubWhat it is
The full explanation is in README.md.