Загрузка видео...

Не удалось загрузить видео

На главную

Custom property powered responsive scroll animations with CSS 🔥 .card { animation: morph; animation-timeline: --scroll; } .card--one { --x: -35vw; --r: -10deg; } .card--two { --x: 35vw; } @​keyframes morph { 0% { translate: var(--x) var(--y); rotate: var(--r); } }

201,871 просмотров • 2 лет назад •via X (Twitter)

Комментарии: 10

Фото профиля jhey ▲🐻🎈
jhey ▲🐻🎈2 лет назад

Here's that @CodePen link! 🚀 The trick here is powering all the card animations with custom properties 🔥 .card--one { --r: -20deg; } .card--two { --r: 15deg; } .card--three { --r: -8deg; } One set of keyframes, with many results 🤙

Фото профиля Sebastian
Sebastian2 лет назад

im rdy to step up my css

Фото профиля jhey ▲🐻🎈
jhey ▲🐻🎈2 лет назад

Every demo is a POC for getting that course out there eventually 😅 (Temporarily Figma Config fuel)

Фото профиля Vlad
Vlad2 лет назад

We are a long way from the first sketch haha 😜 💙 @mboudoukhane 🫶

Фото профиля Arnob Dada
Arnob Dada2 лет назад

Looks awesome, @CycleProduct tagging just so you know ❤️💪

Фото профиля Anastasia 🍑.js
Anastasia 🍑.js2 лет назад

as usual - WOW 🤩

Фото профиля Rock$tar Singh
Rock$tar Singh2 лет назад

I can’t even figure out where to start, CSS has always been extremely overwhelming

Фото профиля Robert P. 🎯
Robert P. 🎯2 лет назад

You never fail to impress me. It's crazy what can be done with pure CSS.

Фото профиля Abdullah Abbasi
Abdullah Abbasi2 лет назад

Absolutely WOW!!!

Фото профиля Endless Impossibility
Endless Impossibility2 лет назад

Awesome as always.

Похожие видео

CSS Tip! 🚥 You can create these trending expanding scroll indicators with scroll-driven animations and flex 🤙 .indicator { animation: grow; animation-range: contain calc(50% - var(--size)...; animation-timeline: var(--card); } @​keyframes grow { 50% { flex: 3; }} What's the trick? Put the indicators in a container using flex layout and set a width larger than the number of indicators 😉 .indicators { aspect-ratio: 7 / 1; display: flex; } Importantly, set no gap 🤏 To mimic the gap set a transparent border on each indicator and set the background using padding-box .indicator { background: linear-gradient(#​fff, #​fff) padding-box; border-radius: 50px; border: 4px solid transparent; } Now for the animation. You want to create a view-timeline for each card that moves across 🤙 li:nth-of-type(1) { view-timeline: --one inline; } li:nth-of-type(2) { view-timeline: --two inline; } Make sure they use the inline axis too! The trick is hoisting these view-timeline so the indicators can use them with timeline-scope 👀 .track { timeline-scope: --one, --two, ...; } All that's left is for you to create the animation piece using some calc with the card size ⚡️ .indicator { --size: calc(var(--card-width) * 0.9); animation: grow both linear; animation-range: contain calc(50% - var(--size)) contain calc(50% + var(--size)); } .indicator:nth-of-type(1) { animation-timeline: --one; } .indicator:nth-of-type(2) { animation-timeline: --two; } @​keyframes grow { 50% { flex: 3; }} And there you have it, responsive scroll indicators using CSS scroll-driven animations 😎 Sprinkle a little JavaScript to make them clickable and scroll the the right card ✨ const shift = (event) => { if (event​.target.tagName === "BUTTON") { const index = [...event.target.parentNode.children].indexOf(event​.target); const item = document.querySelector(`li:nth-of-type(${index + 1})`); item.scrollIntoView({ behavior: "smooth", inline: "center" }); } }; As always, any questions or suggestions, let me know. I've put a JavaScript fallback in to use GSAP in browsers that don't have scroll-driven animations 🫶 CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

575,316 просмотров • 2 лет назад