{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "set-stagger-direction",
  "title": "stagger direction",
  "description": "stagger direction, Allow to animate in orchestrated order depending on the order, can animate from the start item, middle item, last item.",
  "files": [
    {
      "path": "registry/utils/set-stagger-direction/index.ts",
      "content": "export type StaggerDirection = 'first' | 'center' | 'last' | 'random';\n\nexport interface StaggerOptions {\n  direction?: StaggerDirection;\n  staggerValue?: number;\n  totalItems: number;\n  index: number;\n}\n\nexport function setStaggerDirection({\n  direction = 'first',\n  staggerValue = 0.02,\n  totalItems,\n  index,\n}: StaggerOptions): number {\n  switch (direction) {\n    case 'first':\n      // Linear progression from start\n      return index * staggerValue;\n\n    case 'center':\n      // Stagger from the middle outward\n      const middleIndex = Math.floor(totalItems / 2);\n      return Math.abs(index - middleIndex) * staggerValue;\n\n    case 'last':\n      // Linear progression from end\n      return (totalItems - 1 - index) * staggerValue;\n\n    case 'random':\n      // Random stagger between index and totalItems\n      const min = Math.min(index, totalItems);\n      const max = Math.max(index, totalItems);\n      return Math.random() * (max - min) * staggerValue;\n\n    default:\n      return 0;\n  }\n}\n",
      "type": "registry:lib",
      "target": "components/systaliko-ui/utils/set-stagger-direction.ts"
    }
  ],
  "type": "registry:lib"
}