r/react • u/Awkward-Let-4628 • 22h ago
5
Upvotes
r/react • u/Significant-Sea-7238 • 23h ago
OC Width and height on separate springs: how I matched SwiftUI's notch animation in React
1
Upvotes
The Windows version of my notch app is React + Tauri, and it had to move like the SwiftUI original. I wrote SwiftUI's spring (duration + bounce) as a plain function of time, gave width and height their own springs, and only let a growing side overshoot, capped at 12 px.
The code, with tests: https://github.com/MF-DEEV/Openbar/blob/main/windows/src/island/motion.ts
The app is Openbar, a notch-style island for AI coding agents. Free and open source.