Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

This works by using: - normal border-radius - a ::before pseudo-element for the tab - Framer Motion to handle the drag interaction - a tiny distance-to-progress calculation that updates the border radii

309,845 Aufrufe • vor 2 Monaten •via X (Twitter)

36 Kommentare

Profilbild von Haz
Hazvor 2 Monaten

That's cool. I built it a while ago. The biggest challenge is syncing it with nonlinear transitions:

Profilbild von daniel petho
daniel pethovor 2 Monaten

ufff this is so goooood!

Profilbild von Kevin Grajeda
Kevin Grajedavor 2 Monaten

🙌thanks

Profilbild von Said fatah
Said fatahvor 2 Monaten

recreated it using clip-path , this was a fun exercise for my frontend skills .

Profilbild von Spanky McDoob
Spanky McDoobvor 2 Monaten

theres a point where it gets too pointy on the slide, i wonder if that can be fixed

Profilbild von Mathieu Jouhet
Mathieu Jouhetvor 2 Monaten

This reminds me of the technique I used and explain in my how to round svg polygons @observablehq notebook:

Profilbild von Moe Amaya
Moe Amayavor 2 Monaten

Sooo good

Profilbild von Mona
Monavor 2 Monaten

really cool!

Profilbild von Rasmus Andersson
Rasmus Anderssonvor 2 Monaten

Very nice! Add smoothing to the curves (squircle style) and it’ll look even more organic I bet

Profilbild von Kevin Grajeda
Kevin Grajedavor 2 Monaten

Will do!

Profilbild von shawn.
shawn.vor 2 Monaten

thank you for this

Profilbild von Igor bedesqui
Igor bedesquivor 2 Monaten

amazing post thank you

Profilbild von John Rees
John Reesvor 2 Monaten

would you mind sharing what you created this animation with? it's so effective for explaining things!

Profilbild von Ashutosh Rana • UX for AI Products
Ashutosh Rana • UX for AI Productsvor 2 Monaten

Preety cool, the amount of details is crazy

Profilbild von Edoardo Galati
Edoardo Galativor 2 Monaten

So smooth!

Profilbild von Rakibul
Rakibulvor 2 Monaten

superb

Profilbild von Rico
Ricovor 2 Monaten

soo tufff

Profilbild von رِزق
رِزقvor 2 Monaten

The devil is in the details. 😫

Profilbild von Rene Wang
Rene Wangvor 2 Monaten

love your attention on details. gonna feature this on

Profilbild von AI Mastery Guide
AI Mastery Guidevor 2 Monaten

That distance to progress trick is such a clever way to handle the drag.

Profilbild von Wes Winder
Wes Windervor 2 Monaten

that's beautiful

Profilbild von Isaiah
Isaiahvor 2 Monaten

yes thank you so much for the debug view! so cool (:

Profilbild von Nicolas
Nicolasvor 2 Monaten

Love those details nobody notices, they're what puts the app ahead of competitors.

Profilbild von Avi Ashkenazi
Avi Ashkenazivor 2 Monaten

Love the details

Profilbild von Chauve Camille
Chauve Camillevor 2 Monaten

It's really good. 🔥

Profilbild von meowhib
meowhibvor 2 Monaten

is there any design reasoning behind why the blue circle is smaller than the red one?

Profilbild von MIKE SUNDAY
MIKE SUNDAYvor 2 Monaten

I love this.

Profilbild von Said fatah
Said fatahvor 2 Monaten

sick ! recreating this right now !

Profilbild von Saksham Arora
Saksham Aroravor 2 Monaten

This is so cool. Thanks for the clear breakdown

Profilbild von 猫不困
猫不困vor 2 Monaten

学到了,大佬 Learned something, expert!

Profilbild von Eerie Pariah
Eerie Pariahvor 2 Monaten

Nobody will notice this

Profilbild von Alireza Najafi
Alireza Najafivor 2 Monaten

Could we have borders around the selected tab and the content area with this approach? I tried this but it got very messy

Profilbild von Noel
Noelvor 2 Monaten

Distance-to-progress driving the border radii is such a clean trick. Most people overbuild this with SVG morphs — mapping drag distance to radius keeps it buttery and still reads like real material.

Profilbild von Jawad Sarwar
Jawad Sarwarvor 2 Monaten

So cool!

Profilbild von oluwasefunmi.
oluwasefunmi.vor 2 Monaten

This is so cool!

Profilbild von Michael Stevanus Hartono
Michael Stevanus Hartonovor 2 Monaten

woww soo cool kevin 👏

Ähnliche Videos

CSS Trick! 🤙 You can create gradient borders on translucent elements using mask-clip and mask-composite with a pseudo-element 🔥 .gradient-border::after { mask-clip: padding-box, border-box; mask-composite: intersect; mask: linear-gradient(transparent, transparent), linear-gradient(white, white); } It's the same "Transparent border trick" from before. But, now you apply it to a pseudo-element 😎 The trick is to create a pseudo-element with a gradient background and then mask it so we only see the part we want, the border ✨ mask-clip defines the area affected by a mask. Similar to how you can define background-size. Using padding-box and border-box constrains the two masks. mask-composite is the magic part ✨ It defines a compositing operation for stacked mask layers. Using intersect means that the parts that overlap get replaced. And this seems to work in all browsers 🙌 As for the rest of the styles... – Make sure you set pointer-events: none on the pseudo-element – Make sure it fills the parent element. You can use position: absolute and inset: 0 – Make sure the background fills the space including the border-width. You can use calc to achieve that: --bg-size: calc(100% + (2px * var(--border))); background: var(--gradient) center center / var(--bg-size) var(--bg-size); That's it! 🚀 Gradient borders on translucent elements. You can set all the backdrop-filter: blur() you like! 😅 CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

269,966 Aufrufe • vor 3 Jahren

CSS Tip! ✨ It's 2024 and you have a new way to make animated borders 🚀 .glow::after { offset-path: rect(0 100% 100% 0 round var(--radius)); animation: loop; } @​keyframes loop { to { offset-distance: 100%; }} Using the offset-* properties you can animate elements along the perimeter of others 😍 The rect() value gained support in Safari 17.2 🙌 To start, you create an element and put it inside your main element. For example, you put a span inside the button 🤙 Click me! Make the element fill its parent with absolute positioning and inset [data-glow] { position: absolute; inset: 0; } Now the good part, you use a pseudoelement on that element and define an offset-path [data-glow]::after { content: ""; offset-path: rect(0 auto auto 0 round var(--radius)); animation: loop 2.6s infinite linear; } With the rect value, you are saying the path fills the parent container: top: 0 right: auto || 100% bottom: auto || 100% left: 0 Then you can use round to make sure the path uses the same radius as whatever the parent has The @​keyframes animation merely animates the offset-distance of that pseudoelement to 100% @​keyframes loop { to { offset-distance: 100%; }} You can see this more clearly in the video 🫶 The offset-* properties also include an offset-anchor property. This allows you to dictate which point of the element follows the path. For example: anchor-offset: 100% 50%; This means that the "right, center" of the element will follow the perimeter of the parent element 🤙 Lastly, the visuals 🎨 For color, you can use a gradient such as a linear gradient to fill the pseudo-element. [data-glow]::after { background: radial-gradient( circle at right, hsl(320 90% 100%), transparent 50% ); } Then clip away everything so you only have the border and can still have translucent backgrounds, etc. Use a mask with mask-composite ✨ A little transparent border trick: [data-glow] { border: 2px solid transparent; mask: linear-gradient(transparent, transparent), linear-gradient(white, white); mask-clip: padding-box, border-box; mask-composite: intersect; } Bit of a long one. Hope you find it useful 🙏 CodePen.IO link below 👇

jhey ʕ•ᴥ•ʔ

283,498 Aufrufe • vor 2 Jahren