Загрузка видео...

Не удалось загрузить видео

На главную

Similar technique 🤙 1. Take a scroll-snap list 2. Apply CSS scroll animations ✨ img { animation: flow; animation-timeline: --cover; } keyframes flow { 0% { transform: translate(-80%, 0) rotateY(-33deg); } } Few lines of CSS make it a progressively enhanced animated list 🔥

114,209 просмотров • 2 лет назад •via X (Twitter)

Комментарии: 8

Фото профиля jhey ▲🐻🎈
jhey ▲🐻🎈2 лет назад

Here's the @CodePen link 🚀 Definitely required as I can't fit a decent chunk of keyframes into that post without making it an essay 😅

Фото профиля Ola_Lekan
Ola_Lekan2 лет назад

what is the flow animation and --cover ?

Фото профиля jhey ▲🐻🎈
jhey ▲🐻🎈2 лет назад

The keyframes were a little long to squeeze in here 🤏 "flow" is the animation-name "--cover" is the animation-timeline The animation-timeline is based on the list item position and the animation is applied to the image that's contained 🤙

Фото профиля Naveen
Naveen2 лет назад

@X should bring syntax highlighting just for this guy! 👀

Фото профиля Tomas Jansson
Tomas Jansson2 лет назад

how quickly you create these demos are mind-blowing!

Фото профиля eboye | デジタルボーイ
eboye | デジタルボーイ2 лет назад

I remember doing this in flash / actionScript 👀

Фото профиля Glow Design Agency
Glow Design Agency2 лет назад

hm, interesting🫢

Фото профиля Epictetus
Epictetus2 лет назад

This is awesome!

Похожие видео

Future CSS Tip! 🍏 You can create this Apple-style photo scroller by combining CSS scroll-driven animations and CSS scroll-snap 😍 Peep those changing captions 👀 No JS! img { animation: highlight both linear; animation-timeline: view(inline); 👈 Horizontal animation-range: cover 0% cover 50%; 👈 Finish } @ keyframes highlight { 50% { translate: 0 0; scale: var(--starting-scale); 👈 props opacity: var(--starting-opacity); 👈 } 100% { translate: 0 0; scale: 1; opacity: 1; } } Without the animation support, you get a standard unordered list containing some s 🤙 How do we swap the captions though? The "trick" is to use position: absolute on the figcaption and animate their opacity based on the ViewTimeline of their parent list item 😎 figcaption { animation: show both linear; animation-timeline: --list-item; } @ keyframes show { 0%, 45%, 55%, 100% { opacity: 0; } 50% { opacity: 1; } } li { view-timeline-name: --list-item; view-timeline-axis: inline; 👈 important! } The parent of the scroll track uses position: relative so all the captions sit in the middle even though they are in the right place for the markup 🙌 The last bit is the scroll-snap 🤙 Not much to it at all. Wrap the list and make it scrollable. Then add scroll-snap-type .wrapper { scroll-snap-type: x mandatory; overflow-x: scroll; } Then make sure each list item has scroll-snap-align set on it li { scroll-snap-align: center; } That's it! Pretty cool demo to put together and see how to do this stuff with these APIs 🤓 A lot of cool little tricks to pick up for writing your CSS! ⭐️ CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

232,131 просмотров • 2 лет назад