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

NameTypeDescriptionDefault
animationNamestringCSS animation name.-
durationnumberDuration in milliseconds.-
options{ autoPlay?: boolean; loop?: boolean; delay?: number }Additional animation options.-

Returns

NameDescription
isAnimatingWhether the animation is currently running.
iterationsNumber of completed iterations.
play() / pause() / reset()Control helpers for the animation lifecycle.
animationStylesInline 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.
Saha UI - The Modern React Component Library