UNPKG

react-textmotion

Version:

Lightweight yet powerful library that provides variable animation effects for React applications.

24 lines (23 loc) 1.19 kB
import type { AnimationOrder, Motion } from '../../types'; type UseAnimatedProps = { splittedText: string[]; initialDelay: number; animationOrder: AnimationOrder; resolvedMotion: Motion; onAnimationEnd?: () => void; }; /** * @description * `useAnimatedText` is a custom hook that animates an array of strings. * It manages the animation sequence index to apply delays correctly. * * @param {string[]} splittedText - The array of strings to be animated. * @param {number} initialDelay - The initial delay before the animation starts, in seconds. * @param {AnimationOrder} animationOrder - Defines the order in which the animation sequence is applied. Defaults to `'first-to-last'`. * @param {Motion} resolvedMotion - The motion configuration object, which is a result of merging custom motion and presets. * @param {() => void} onAnimationEnd - Callback function that is called when the animation ends. * * @returns {ReactNode[]} An array of animated React nodes. */ export declare const useAnimatedText: ({ splittedText, initialDelay, animationOrder, resolvedMotion, onAnimationEnd, }: UseAnimatedProps) => import("react/jsx-runtime").JSX.Element[]; export {};