正在加载视频...

视频加载失败

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 次观看 • 2 个月前 •via X (Twitter)

36 条评论

Haz 的头像
Haz2 个月前

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

daniel petho 的头像
daniel petho2 个月前

ufff this is so goooood!

Kevin Grajeda 的头像
Kevin Grajeda2 个月前

🙌thanks

Said fatah 的头像
Said fatah2 个月前

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

Spanky McDoob 的头像
Spanky McDoob2 个月前

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

Mathieu Jouhet 的头像
Mathieu Jouhet2 个月前

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

Moe Amaya 的头像
Moe Amaya2 个月前

Sooo good

Mona 的头像
Mona2 个月前

really cool!

Rasmus Andersson 的头像
Rasmus Andersson2 个月前

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

Kevin Grajeda 的头像
Kevin Grajeda2 个月前

Will do!

shawn. 的头像
shawn.2 个月前

thank you for this

Igor bedesqui 的头像
Igor bedesqui2 个月前

amazing post thank you

John Rees 的头像
John Rees2 个月前

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

Ashutosh Rana • UX for AI Products 的头像
Ashutosh Rana • UX for AI Products2 个月前

Preety cool, the amount of details is crazy

Edoardo Galati 的头像
Edoardo Galati2 个月前

So smooth!

Rakibul 的头像
Rakibul2 个月前

superb

Rico 的头像
Rico2 个月前

soo tufff

رِزق 的头像
رِزق2 个月前

The devil is in the details. 😫

Rene Wang 的头像
Rene Wang2 个月前

love your attention on details. gonna feature this on

AI Mastery Guide 的头像
AI Mastery Guide2 个月前

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

Wes Winder 的头像
Wes Winder2 个月前

that's beautiful

Isaiah 的头像
Isaiah2 个月前

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

Nicolas 的头像
Nicolas2 个月前

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

Avi Ashkenazi 的头像
Avi Ashkenazi2 个月前

Love the details

Chauve Camille 的头像
Chauve Camille2 个月前

It's really good. 🔥

meowhib 的头像
meowhib2 个月前

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

MIKE SUNDAY 的头像
MIKE SUNDAY2 个月前

I love this.

Said fatah 的头像
Said fatah2 个月前

sick ! recreating this right now !

Saksham Arora 的头像
Saksham Arora2 个月前

This is so cool. Thanks for the clear breakdown

猫不困 的头像
猫不困2 个月前

学到了,大佬 Learned something, expert!

Eerie Pariah 的头像
Eerie Pariah2 个月前

Nobody will notice this

Alireza Najafi 的头像
Alireza Najafi2 个月前

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

Noel 的头像
Noel2 个月前

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.

Jawad Sarwar 的头像
Jawad Sarwar2 个月前

So cool!

oluwasefunmi. 的头像
oluwasefunmi.2 个月前

This is so cool!

Michael Stevanus Hartono 的头像
Michael Stevanus Hartono2 个月前

woww soo cool kevin 👏

相关视频

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 次观看 • 3 年前

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 次观看 • 2 年前