I have a Mac app whose panel lives in the notch, animated with SwiftUI springs. When I rebuilt it in React for Windows (inside a transparent Tauri window), the same resize felt wrong with a single spring on the whole size.
What fixed it: width and height each get their own spring, chosen by whether that side is growing or shrinking. A growing side may overshoot a little, while a shrinking one never does, and the overshoot is capped by distance so big jumps don't wobble.
export function sideSpring(from: number, to: number, width: boolean): Spring {
const spring =
to > from
? width ? Springs.growingWidth : Springs.growingHeight
: width ? Springs.shrinkingWidth : Springs.shrinkingHeight;
return limitedSpring(spring, Math.abs(to - from), OVERSHOOT_LIMIT);
}
export function sizeAt(time: number, from: Size, to: Size): Size {
const side = (start: number, end: number, width: boolean) =>
start === end ?…