Skip to content
Back to the lab

GSAP Flip · one element sliding

The sliding highlight on filter tabs

The highlight that marks the selected option in the software page's filter: on a change it slides from the previous option to the new one.

Source · GitHub

The indicator is a single element. On a change, Flip.getState records its position, it is moved to the new slot, and Flip.from plays the difference between the two positions, so it slides over from the previous slot. The first placement is not animated, because there is no previous state. When the window width changes its position is measured again without animation. The arrow keys also move between options. The reshuffling of the tiles in the grid is a separate study.

Source

Source files on GitHub:

Back to the lab