()
| 100 | const [frameIndex, setFrameIndex] = useState(-1); |
| 101 | const sequenceRef = useRef<readonly Frame[]>(JUMP_WAVE); |
| 102 | const onClick = () => { |
| 103 | if (reducedMotion || frameIndex !== -1) return; |
| 104 | sequenceRef.current = CLICK_ANIMATIONS[Math.floor(Math.random() * CLICK_ANIMATIONS.length)]!; |
| 105 | setFrameIndex(0); |
| 106 | }; |
| 107 | useEffect(() => { |
| 108 | if (frameIndex === -1) return; |
| 109 | if (frameIndex >= sequenceRef.current.length) { |