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 <header> 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 <video> element stays in the shot whilst you scroll the page. As it leaves the page, it scales down inside the <header> 🫶
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> 👀
header { view-timeline: --header; }
You have a pseudoelement on the text content of the header that lives inside a <section>'
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 🤙
Here's that @CodePen link! 🚀
https://codepen.io/jh3y/pen/jOJZYRm
Video Credit By: https://twitter.com/jh3yy
#viral #shortvideo #shortsvideo #ai #aiart #artificialintelligence #youtubeshorts #youtubeshort #shorts #short #shortsfeed #ytshorts #ytshort #trending #trendingshorts #trend #technology #tech #midjourney #Selfie #AIart #FaceSwap #youtube #vlog #youtuber #contentcreator #youtubeshorts #newvideo #vlogger #comment #vloglife #creator #marketing #influencer #youtubeviews #community #youtubeindia #videomarketing #youtubeuse #youtubechannel #youtubelife #youtubecommunity #youtubesubscribers #youtubecontent #youtubelive #youtubecreator #trending #video #viral #youtubevideo #popular #youtubeislife #subscribe #thanks #hashtag #love #youtubeintro #trending #howto #trendingnow #diy #viral #tutorial #popular #review #hot #breakingnews #top10 #top5 #challenge #science #stemeducation #technology #sciencecommunication #innovation #techinnovation #stem #internetofthings #engineering #cloudcomputing #coding #datascience #artificialintelligence #cybercrime #virtualreality #ethicalhacking #cybersecurity #quantumcomputing #futuretech #tech #webdevelopment #computerscience #AI #programming #machinelearning #gaming #html #html5 #htmltutorial #css #css3 #buttoncss #trend #web #webdevelopment #webdesigner #webdesign #video #videos