正在加载视频...

视频加载失败

Scrolling parallax cards with CSS scroll animation 📜 article { scale: 0.8; animation: scale; animation-timeline: view(inline); animation-range: cover 40% cover 60%; } @​keyframes scale { 50% { scale: 1; }}

95,630 次观看 • 2 年前 •via X (Twitter)

10 条评论

Wilson Hou 的头像
Wilson Hou2 年前

this looks so good cries in caniuse

Bug Buster 🐞 CLONE 的头像
Bug Buster 🐞 CLONE2 年前

Codepen link?

Fat Bytes 的头像
Fat Bytes2 年前

Do you have a course?

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

I'll start working on it in Q3 🤙 That and hopefully a book 🤞

John 的头像
John1 年前

Cool

Januario 的头像
Januario2 年前

And you still have time for your wife, job, workouts... The productivity is insane.

Matt Stoffel 的头像
Matt Stoffel2 年前

Wow

SamAGI 的头像
SamAGI2 年前

👍

nszbf 的头像
nszbf2 年前

🥳

Tyrone C. 的头像
Tyrone C.2 年前

So smooth 🔥

相关视频

CSS Tip! 🐳 You can add little details like this scale down on scroll effect with scroll-driven animations and some sticky positioning 🤙 section { animation: scale-down; animation-timeline: view(); animation-range: exit; } @​keyframes scale-down { to { scale 0.8; } ] In this smaller example, you can lean into using the position to drive an animation that scales itself down as it leaves the viewport (Seen on the Apple Vision Pro site 🍏) The nice thing here is that if you don't have scroll-driven animations, the user still gets a good experience ✨ So how do you do it? There isn't much to it header { transform-origin: 50% 0%; animation: scale-down both ease-in; animation-timeline: view(); animation-range: exit; view-timeline: --header; } @​keyframes scale-down { to { scale: 0.8 0.8; } } That's it. The layout makes use of position: sticky so that the element stays in the shot whilst you scroll the page. As it leaves the page, it scales down inside the 🫶 The other smol animation here is fading the overlay on the video out 😎 Real easy. You may notice the view-timeline you defined above for the 👀 header { view-timeline: --header; } You have a pseudoelement on the text content of the header that lives inside a header > section::before { background: hsl(0 0% 0% / 0.75); opacity: 1; animation: fade both linear; animation-timeline: --header; animation-range: exit-crossing 0% exit 0%; } @​keyframes fade { to { opacity: 0; } } You use a slightly smaller range on this with exit-crossing to fade it out before you start the scale down animation 🤏 That's it! Thought this smaller example would be easier to grok for people 🙏 It's also covered with JavaScript if you really want it for your sites 🤙 CodePen.IO link below 👇

jhey ʕ•ᴥ•ʔ

146,270 次观看 • 2 年前