{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "motion",
  "title": "Motion presets",
  "description": "Critically damped and momentum springs, Apple's momentum projection and rubber-banding, shared by every moving Mise UI component.",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "registry/miseui/lib/motion.ts",
      "content": "import type { Transition } from \"motion/react\"\n\n/**\n * Critically damped spring: no overshoot. The default for anything the user\n * did not throw. Apple ships damping 1.0 / response 0.35 s for the same job.\n */\nexport const SPRING_DEFAULT: Transition = { type: \"spring\", bounce: 0, duration: 0.35 }\n\n/**\n * Slight overshoot, only after a gesture carried momentum (a flick, a drag\n * release). Overshoot on something that merely faded in reads as wrong.\n */\nexport const SPRING_MOMENTUM: Transition = { type: \"spring\", bounce: 0.2, duration: 0.4 }\n\n/** Short settle for press feedback; must land under the ~100 ms perception threshold. */\nexport const SPRING_PRESS: Transition = { type: \"spring\", bounce: 0, duration: 0.15 }\n\nconst DEFAULT_DECELERATION_RATE = 0.998\nconst DEFAULT_RUBBERBAND_CONSTANT = 0.55\n\n/**\n * Where a flick would come to rest if nothing stopped it (Apple's exponential\n * decay, not the textbook v²/2a). Pick the snap point nearest this value, then\n * hand the same velocity to the spring so there is no seam between drag and settle.\n */\nexport function projectMomentum(velocityPxPerSecond: number, decelerationRate = DEFAULT_DECELERATION_RATE) {\n  return ((velocityPxPerSecond / 1000) * decelerationRate) / (1 - decelerationRate)\n}\n\n/**\n * Progressive resistance past a boundary. The further past the edge, the less\n * the element follows, so the edge reads as \"nothing more here\", not \"frozen\".\n */\nexport function rubberband(overshoot: number, dimension: number, constant = DEFAULT_RUBBERBAND_CONSTANT) {\n  return (overshoot * dimension * constant) / (dimension + constant * Math.abs(overshoot))\n}\n\n/** Clamp a 0..1 progress value; NaN and out-of-range inputs are common from sensors. */\nexport function clampUnit(value: number) {\n  if (Number.isNaN(value)) return 0\n  return Math.min(1, Math.max(0, value))\n}\n",
      "type": "registry:lib"
    }
  ],
  "type": "registry:lib"
}