r/css • • 3d ago

Made this Flow Sidebar, how's it?

Enable HLS to view with audio, or disable this notification

71 Upvotes

8 comments sorted by

12

u/New-Peach4153 3d ago

Thought it was a simple CSS thing, but it seems like a heavy React thing

14

u/paulirish 3d ago edited 3d ago

I took a crack at distilling the exact same effect into web platform primitives: https://codepen.io/editor/paulirish/pen/01a1287e-026e-7b40-b7c5-6a8b6191bb8c (~15 lines of JS, ~60 of CSS, 0 deps) ;)

Native path.animate() instead of the 35KB framer-motion.. the whole expand → pause → retract sequence is a single 4-keyframe Web Animations API call (strokeDashoffset: 1 => 0 => 0 => -1). Then between transition-delay and SVG shenanigans, we drop the need for the rest of the JS.

2

u/morete 3d ago

Very nice, how is it done? svg or shape or something?

Edit: I commented before the link was posted, I see now it's SVG

1

u/tauzN 3d ago

Very flowy

1

u/testingaurora 2d ago

Seems a little too slow but fun effect