Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

947 B
Raw Blame
/**
 * Width and offset are driven by springs rather than CSS transitions: both are layout
 * responses β€” several tabs resize and shift at once whenever one is activated, added,
 * closed or pinned β€” and a spring both settles more naturally and is interruptible, so
 * rapid switching redirects the motion instead of restarting a fixed ramp.
 *
 * Every animated quantity in the strip shares this one config on purpose. Same-parameter
 * springs superpose, which is what makes a tab's independently sprung x trace the same
 * path as the running sum of its neighbours' sprung widths β€” see `resolvePlacements`.
 *
 * restDelta of half a pixel: without it the spring keeps ticking rAF long after the
 * motion is visually over (measured still 0.1px short at 425ms), which costs a frame
 * callback per tab for nothing.
 */
export const TAB_SPRING = {
  damping: 26,
  mass: 0.4,
  restDelta: 0.5,
  restSpeed: 2,
  stiffness: 380,
} as const;