Recreating the MacOS Dock Animation in CSS

CleanShot 2023-04-13 at 18 25 59

In this video we'll be recreating the MacOS dock animation you see when hovering an app icon on desktop. We do this by combining both the new CSS has() selector and CSS variables in a smart way. This results in us being able to quite closely replicate the dock animation, without the use of any animation libraries like Framer Motion or GASP.

Links

Source code

Tools used

React (could also be built with Vanilla JS), TypeScript, Vanilla CSS (using the has() selector!), CSS Variables.

Image copyright

Wallpaper source: https://unsplash.com/photos/4wzRuAb-KWs

Icons source: https://macosicons.com/#/