Utility
useAnimation
Animation utilities for creating smooth transitions and motion effects.
import { useAnimation } from "saha-ui"Uses
Control CSS-style animations programmatically: play, pause, reset, and provide computed inline styles for animation attributes.
Props
| Name | Type | Description | Default |
|---|---|---|---|
| animationName | string | CSS animation name. | - |
| duration | number | Duration in milliseconds. | - |
| options | { autoPlay?: boolean; loop?: boolean; delay?: number } | Additional animation options. | - |
Returns
| Name | Description |
|---|---|
| isAnimating | Whether the animation is currently running. |
| iterations | Number of completed iterations. |
| play() / pause() / reset() | Control helpers for the animation lifecycle. |
| animationStyles | Inline style object for animation-related CSS properties. |
Example
const { play, animationStyles } = useAnimation('fade', 500, { autoPlay: false });
return <div style={animationStyles}>Animated</div>;Notes
Provides simple high-level animation control; not tied to a specific animation library.