usePulse
@hua-labs/hua/motion
bash
npm install @hua-labs/huatsx
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
| duration | number | 3000 | Pulse cycle duration in milliseconds |
| intensity | number | 1 | Pulse intensity (affects opacity range) |
| repeatCount | number | Infinity | Number of repetitions (Infinity for infinite loop) |
| repeatDelay | number | 0 | Delay between each repeat cycle in ms |
| autoStart | boolean | false | Start pulsing automatically |
| ref | RefObject<T | null> | Ref to attach to element |
| style | CSSProperties | Animated opacity style |
| isVisible | boolean | Visibility state |
| isAnimating | boolean | Whether currently pulsing |
| progress | number | Pulse cycle progress (0-1) |
| start | () => void | Start pulsing |
| stop | () => void | Stop pulsing |
| reset | () => void | Reset to initial state |