drei/view got a massive update. mix webgl/three right into your html as views, as many as you want. they're self contained. events, controls, everything works. it's driven by a single canvas split into chunks via webgl_skissor.
the demo is made with @nextjs@shadcn@v0
If you are a UI/UX Designer and you don't know how to create 3D mockups using Figma. In this post, I'll show you a step-by-step guide on how to create 3D mockups using Figma for your next UI design project.
Reposts are highly appreciated 💜
CSS Tip 🤙
You can create this header effect using position: sticky, clip-path, and custom properties 🔥 (Video 👀)
header { position: sticky; top: var(--margin); }
main { clip-path: inset(var(--header) 0 0 0);) }
No mix-blend-mode or animations required ✨
What's the trick then? 🧐
Duplicate the header element first. Then fix the positioning of one behind the content.
header[aria-hidden] {
position: fixed;
top: 0;
margin-top: var(--margin);
}
Clip the top of the content to reveal the fixed header and put a sticky-positioned header inside it that matches up in position and size ✂️
:root {
--header: calc(var(--margin) + var(--font-size));
}
main {
clip-path: inset(var(--header) 0 0 0);
}
header {
position: sticky;
top: var(--margin);
}
Make your life easier with custom properties 🙌
As the body scrolls, the fixed header gets covered by the clipped content and creates the effect ✨ And because the sticky header is "stuck" it reveals itself as the content goes out of view 😍
This one's pretty cool. You can set the font color to whatever you want. At first glance, it looked like it was a mix-blend-mode thing. It doesn't have to be! Think about it and lean into z-indexing 🫶
Watch the video to get an idea of things with the exploding view 🤯
Any questions, etc. let me know! Will likely do a YouTube video on this one too! 🙏
@CodePen link below! 👇
If you want to become a better software engineer, read these famous posts from top companies (OpenAI, Airbnb, Stripe, Figma, Netflix, Meta)
I spent hours curating top posts so you don't have to:
Alternative solution could be setting up the HTML so you don't need an animation at all 😉
A combination of position: sticky and clip-path: inset() could achieve a similar effect
Couldn't resist having a go when I saw your video 🙏
codepen.io/jh3y/pen/ExMaPbW
CSS Trick 🤙
You can use scroll-driven animations on the inline axis to create list animations like in these cards 🫶
article {
animation: vibe;
animation-timeline: view(inline);
animation-range: cover 40% cover 60%;
}
@keyframes vibe { 50% { scale: 1; filter: grayscale(0); }}
Here you use a view() timeline with the inline axis set inside the function. This means you can hook into the horizontal scroll position of an element inside its scroller 🙌
In this demo, you set a default smaller scale and make each card grayscale 🤏
article {
scale: 0.8;
filter: grayscale(1);
}
Then the animation happens as each card enters from the right at 0% and leaves to the left at 100% 🎞️ 50% is the halfway point and in your keyframes you make each card grow and saturate at that point before returning to its original state ✨ scroll-snap provides a nice look-and-feel here and on mobile 🫰
It's really as straightforward as that but made so much easier with a few lines of CSS 💙 For the parallax effect, you can animate a background-position on the card or the object-position on an img depending on what you go with 🤙
Lastly, you can use this today with progressive enhancement by wrapping your scroll-driven animation code in @supports and @media ⚡️ Users without support still get a decent experience!
@CodePen link below! 👇
Found this old prototype I made for a thing that's been sitting dormant in dropbox for a few years. Never got published, so its memory will now live on in this tweet.