正在加载视频...

视频加载失败

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!

相关视频

CSS Tip! 📜 You can use scroll-driven animations to progressively enhance collapsing a floating call to action 🤏 .cta { animation: shrink; animation-timeline: scroll(); animation-range: 0 100px; } @​keyframes shrink { to { width: 48px; } } That's the gist of it. Use the body scroll position with animation-timeline: scroll(). Define the animation-range as when you have scrolled 100px. There's a little more though 🤓 That would "scrub" the width animation. Ideally, you want to trigger that animation. You could animate a custom property with steps() timing and use that to define the width ✨ @​property --scrub { syntax: ' '; inherits: true; initial-value: 0; } body { animation: scrub both steps(1, end); animation-timeline: scroll(); animation-range: 0 100px; } Then transition the --scrub property on the CTA and use it for the width 🤙 .cta { transition: --scrub 0.2s; width: calc(48px + (120px * (1 - (var(--scrub) / 100)))); } Other animations are a matter of preference and timing. For example, you could then make the hand wave, scale down the size, and then slide a gradient across 😉 They have the same structure and technique as the original concept. Waving the hand? 👋 Run it twice, offset the transform-origin. .hand { animation: wave both linear 2; animation-timeline: scroll(); animation-range: 30vh 50vh; transform-origin: 65% 75%; } @​keyframes wave { 50% { rotate: 20deg; } } How's it progressively enhanced? Wrap everything in a @​supports query and a @​media query. If there isn't support, users still get a good experience. It's a floating action button that's circular and already collapsed 🤙 @​supports(animation-timeline: scroll()) { @​media(prefers-reduced-motion: no-preference) {...} } Definitely have a play with the code. Amazing what we're going to be able to do with CSS alone! 🔥 CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

177,781 次观看 • 2 年前