Future CSS Tip! 🔮
You can create sweet scroll-driven micro-interactions using CSS scroll-driven animations 😎
.avatar {
animation: scale-down;
animation-timeline: scroll();
animation-range: var(--header-range);
}
@ keyframes scale-down {
to {
scale: 0.3;
}
}
What's happening in this one? 👀
1. Avatar moves and scales down as the header sticks
2. Name changes color and slides over
3. Header darkens to give the text contrast
4. Header gets a shadow
5. Notice the avatar scrub too! 👀 It's scroll-driving the sprite animation technique we went over earlier in the week ✨
So much fun! ✨ Could even tie in the new easings from earlier too!
@CodePen link below! 👇