King of Hearts on scroll by Ben Evans on CodePen
Open on CodePen ↗A hand-drawn King of Hearts playing card that turns as you scroll. Ben Evans first made it to play on hover, but that was a bit jittery, so he swapped the hover trigger for animation-timeline: scroll() and fixed the card in place on a taller page.
Everything is CSS, including the card face. The king's hair is layers of box-shadow with no blur, and the card back is a single element.
artscroll-drivenanimation-timelinebox-shadow
The modern.css newsletter
New CSS each month, and new things in the Atlas. 806 subscribers. Past issues
by Cyd Stumpel
by Chris Bolson
by Kiarash Zarinmehr