Skip to content
Fixed: blur(4px) on every movePick a tab
Scaled: up to 4px, by distancePick a tab

Rebuild

Blur that scales with distance

Blur scales with distance up to 4px: 1.33px for one tab, 4px for three, peaking halfway along a 530ms spring with no bounce.

A fixed blur treats every move the same. At 4px, a one-tab hop smears for a pill that barely moved, and a jump across three tabs reads as no faster than one. Blur that scales with distance matches what the eye expects from motion blur: the farther it goes, the softer it gets, so one tab gets 1.33px and three get the full 4px.

The blur follows the trip, not a timer: blur = 4px × distance / 264px × 4 × progress × (1 − progress). It’s zero as the pill leaves, peaks halfway, and clears as it lands on a 530ms spring with no bounce, so the pill is already moving before it softens and sharp again as it settles. A tap mid-flight starts the next move from where the pill is and how fast it’s going, so nothing jumps.

Rebuilt from
Hour 92The post
"use client"

import { useRef, useState } from "react"
import { INITIAL_MOVE, type Move, moveTo } from "../../_lib/pill"
import { useClock } from "../../_lib/use-clock"
import { useReducedMotion } from "../../_lib/use-reduced-motion"
import { BlurCompareTabBar } from "./nested/tab-bar"

/** The same tab bar twice, driven by one state: a fixed blur on top, a blur scaled to distance below. */
function BlurCompare() {
  const reduced = useReducedMotion()
  const root = useRef<HTMLDivElement>(null)
  const { now, nowRef } = useClock(root, reduced)
  const [active, setActive] = useState(0)
  const [move, setMove] = useState<Move>(INITIAL_MOVE)

  const select = (index: number) => {
    setActive(index)
    setMove((current) => moveTo(current, nowRef.current, index))
  }

  return (
    <div ref={root} className="flex flex-col items-center gap-10 max-sm:[zoom:0.85]">
      <BlurCompareTabBar mode="fixed" move={move} now={now} active={active} still={reduced} onSelect={select} />
      <BlurCompareTabBar mode="scaled" move={move} now={now} active={active} still={reduced} onSelect={select} />
    </div>
  )
}

BlurCompare.TabBar = BlurCompareTabBar

export { BlurCompare }
All entries