react-textmotion
Version:
Lightweight yet powerful library that provides variable animation effects for React applications.
20 lines (19 loc) • 993 B
TypeScript
import { type CSSProperties } from 'react';
import type { Motion } from '../../types';
export type StyleWithCustomProperties = CSSProperties & {
[key: `--${string}`]: string | number;
};
/**
* @description
* `generateAnimation` is a utility function that generates CSS animation styles from a motion configuration object.
* It creates the `animation` property and any custom CSS properties needed for the animations.
*
* @param {Motion} motionConfig - The motion configuration object.
* @param {number} sequenceIndex - The index of the element in the animation sequence, used to calculate the animation delay.
* @param {number} [initialDelay=0] - The initial delay before the animation starts, in seconds. Defaults to `0`.
*
* @returns {{ style: StyleWithCustomProperties }} An object containing the generated CSS styles.
*/
export declare const generateAnimation: (motionConfig: Motion, sequenceIndex: number, initialDelay: number) => {
style: StyleWithCustomProperties;
};