Skip to content

useRepeat

@hua-labs/hua/motion

bash
npm install @hua-labs/hua
tsx
import { useRepeat } from "@hua-labs/hua/framework";

tsx
const repeat = useRepeat({ type: "pulse", intensity: 0.1 });

return (
  <div ref={repeat.ref} style={repeat.style}>
    Pulsing element
  </div>
);

count: -1 (infinite)

count: 3

: 0/3

type"pulse" | "bounce" | "wave" | "fade""pulse"Preset animation type
durationnumber1000Animation cycle duration in milliseconds
delaynumber0Delay before starting
intensitynumber0.1Animation intensity (scale/opacity amount)
autoStartbooleantrueStart repeating automatically

refRefObject<T | null>Ref to attach to element
styleCSSPropertiesAnimated style (transform + opacity + transition)
isVisiblebooleanVisibility state (always true)
isAnimatingbooleanWhether animation is active
progressnumberCurrent cycle progress (0-1)
start() => voidStart repeating
stop() => voidStop repeating and reset
reset() => voidReset to initial state