Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

scroll to type with CSS ✨ p { animation: type steps(124); animation-timeline: --main; background: var(--cursor) calc(var(--pos) * 1ch) 0 / 1ch 1lh no-repeat border-box, var(--txt) 0 0 / calc(var(--pos) * 1ch) 100% no-repeat text; } @​keyframes type { to { --pos: 124; }}

117,737 Aufrufe • vor 1 Jahr •via X (Twitter)

12 Kommentare

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 1 Jahr

here's the @CodePen for this one! 🤙 wanted to tidy a little before postin' it happy to throw together the JavaScript version if you need, the concept is the same ✨

Profilbild von Anima
Animavor 1 Jahr

📢It is live! @figma design to @MUI_hq or @AntDesignUI "Whether your design is well organized or a bit chaotic, using standard components or none, Anima takes it all and translates it into high-quality #MUI or #AntDesign code."-->

Profilbild von Ram Maurya
Ram Mauryavor 1 Jahr

Dang! I feel like I need a crash course on modern CSS

Profilbild von Stefan Roberts
Stefan Robertsvor 1 Jahr

Honestly every time you post some absolutely mind-blowing CSS it makes me question everything

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 1 Jahr

thanks Stefan 🙏

Profilbild von Gustav Ekerot
Gustav Ekerotvor 1 Jahr

not sure how many times I can say this but: genius

Profilbild von Enterprise Software Architecture
Enterprise Software Architecturevor 1 Jahr

👀 Beautiful! Syntax highlighting for programming codes would be great.

Profilbild von wallkroft1212
wallkroft1212vor 1 Jahr

Is it possible to get code? I tried to find it on your cdpn, but couldn't

Profilbild von Adrien Duval🇨🇲
Adrien Duval🇨🇲vor 1 Jahr

Can you do a codepen of this

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 1 Jahr

posted it underneath 🤙 gonna add some extra breakdown for it

Profilbild von Mehmet
Mehmetvor 1 Jahr

Does it work on ios chrome?

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 1 Jahr

Chrome doesn't really exist on iOS so not yet But can patch in a snippet of JS to make it work 🤙

Ähnliche Videos

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