Skip to content
Back to the lab

GSAP Flip · the difference, replayed in the layout phase

Cards reshuffling on filter

When the software page's record shelf is filtered by category, the sleeves that stay slide from their old cells to their new positions and the others fade out. Nine coloured tiles stand in for the sleeves here.

Source · GitHub

Every tile stays in the DOM and the filter only toggles display. The timing is what matters: the state has to be captured in the click handler, before React re-renders, and Flip.from runs in a layout-phase useGSAP, so the new positions are never painted first. Entering tiles fade in from scale 0.94 and leaving tiles do the opposite, 30ms apart. The filter buttons here are ordinary buttons; the sliding highlight is in the filter tabs study. The shelf on a phone works the same way, three sleeves per row.

Source

Source files on GitHub:

Back to the lab