Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Future CSS Tip! 📜 You can create these landing page effects with CSS scroll-driven animations and zero JavaScript 🔥 Blurred text on exit? 👀 @​keyframes fade { to { opacity: 0; filter: blur(2rem); } } h2 { animation: fade; animation-timeline: view(); animation-range: cover 40% cover 85%; } Lots of...

426,182 Aufrufe • vor 2 Jahren •via X (Twitter)

9 Kommentare

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Here's that @CodePen link! 🚀 You need to be in Chrome to see this in action 🥲 Will aim to create a polyfilled version using GSAP ScrollTrigger. Threw this together pretty quick/rough 😅

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Will probably need to break this one down into mini posts for the different techniques going on here 🤔 It's mainly tricks with position: fixed and scoped view-timeline ⭐️

Profilbild von Billy191 🔴✨
Billy191 🔴✨vor 2 Jahren

Any implementation with @tailwindcss “

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

@tailwindcss Could totally throw one together. Will require some configured classes for the animation-timeline related properties, etc. Perhaps doing it in Tailwind play would be a good option 🤙

Profilbild von THIRDOCTAV
THIRDOCTAVvor 2 Jahren

Make a video of this. Its 🔥🔥🔥

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Will do! This is the push I needed 🙏 Will do a walkthrough of how the different pieces work

Profilbild von Nine
Ninevor 2 Jahren

When can we expect a lot of these features to be stable in the future? Is it rather far away or let's say 1-2 years

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

@abuzackariyya It shouldn't be too far away, there is intent from other browser engines 🙌 But, I'll update the demo so it can be used with GreenSock too 🤙

Profilbild von busta
bustavor 2 Jahren

looks amazing. when can stuff like this be available in Safari u think?

Ähnliche Videos

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,064 Aufrufe • vor 2 Jahren

CSS Tip! ✨ You can create these parallax effects and image cross-fades with scroll-driven animations 🤙 img { animation: fade; animation-timeline: view(); mix-blend-mode: plus-lighter } img:last-of-type { animation-direction: reverse; } @​keyframes fade { to { opacity: 0; }} This one's fun! 😁 The trick with the cross-fading image is to make use of one animation that runs at the same time on two images inside a container. You use the same animation, animation-timeline, and animation-range. But, you use animation-direction: reverse on one of the images so they go in the opposite direction 🫶 The use of mix-blend-mode: plus-lighter; produces a better cross-fade result 💯 A viewTimeline (view()) works because you know that both images are the same height. The range you can use is img { animation-timeline: view(); animation-range: cover 45% cover 55%; } That means when the image has covered 45% of the scrollport (In this case, the window), start the animation. And finish when it has covered 55% 🎬 How about the slight parallax? This is a trick with calc(). You know the top of the small image and the big image line up. And you can do this by absolutely placing the caption outside of the small image. The trick is to translate the small image by a distance so it lines up with the bottom of the big image. You can do that like this :root { --catch-up: calc( var(--big-height) - var(--small-height) ); } @​keyframes move { to { translate: 0 var(--catch-up); }} Then drive that animation with a scroll-driven animation using the container of both images as the driver 🤙 /* section contains both images */ section { view-timeline: --container; } .img-fader { animation: catch-up both linear; animation-timeline: --container; animation-range: 50vh calc(100vh + (var(--big-height) * 0.25)); } That's it! Scroll-driven image cross-fading and parallax effects without any JavaScript. This demo will work in all browsers as there is some JavaScript in place where the API isn't supported 🤙 To do that, it uses GSAP ScrollTrigger 🏆 As always, any questions, requests, etc. hit me up! 🤙 CodePen.IO link below 👇

jhey ʕ•ᴥ•ʔ

241,952 Aufrufe • vor 2 Jahren