Skip to content

usePulse

@hua-labs/hua/motion

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

tsx
const pulse = usePulse({ intensity: 1, autoStart: true });

return (
  <div ref={pulse.ref} style={pulse.style}>
    <NotificationBadge />
  </div>
);

5

durationnumber3000Pulse cycle duration in milliseconds
intensitynumber1Pulse intensity (affects opacity range)
repeatCountnumberInfinityNumber of repetitions (Infinity for infinite loop)
repeatDelaynumber0Delay between each repeat cycle in ms
autoStartbooleanfalseStart pulsing automatically

refRefObject<T | null>Ref to attach to element
styleCSSPropertiesAnimated opacity style
isVisiblebooleanVisibility state
isAnimatingbooleanWhether currently pulsing
progressnumberPulse cycle progress (0-1)
start() => voidStart pulsing
stop() => voidStop pulsing
reset() => voidReset to initial state