UNPKG

react-textmotion

Version:

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

52 lines (51 loc) 2.08 kB
import { BounceAnimation, CustomAnimation, ElasticAnimation, FadeAnimation, FlipAnimation, RotateAnimation, ScaleAnimation, SlideAnimation } from './animations'; /** * @description * Defines how text is split for animation. * - `character`: Splits the text into individual characters. * - `word`: Splits the text into words. * - `line`: Splits the text into lines. */ export type SplitType = 'character' | 'word' | 'line'; /** * @description * Defines the order of animation. * - `first-to-last`: Animates from the first element to the last element. * - `last-to-first`: Animates from the last element to the first element. */ export type AnimationOrder = 'first-to-last' | 'last-to-first'; /** * @description * A configuration object that defines the animations to be applied. * Each property corresponds to a type of animation and holds its specific configuration. * * @property {FadeAnimation} [fade] - Configuration for fade animation. * @property {SlideAnimation} [slide] - Configuration for slide animation. * @property {ScaleAnimation} [scale] - Configuration for scale animation. * @property {RotateAnimation} [rotate] - Configuration for rotate animation. * @property {BounceAnimation} [bounce] - Configuration for bounce animation. * @property {ElasticAnimation} [elastic] - Configuration for elastic animation. * @property {FlipAnimation} [flip] - Configuration for flip animation. * @property {CustomAnimation} [key] - Configuration for any custom animation. */ export type MotionConfig = { fade?: FadeAnimation; slide?: SlideAnimation; scale?: ScaleAnimation; rotate?: RotateAnimation; bounce?: BounceAnimation; elastic?: ElasticAnimation; flip?: FlipAnimation; [key: string]: CustomAnimation | undefined; }; /** * @description * A configuration object that defines the validation result. * * @property {string[]} errors - An array of error messages. * @property {string[]} warnings - An array of warning messages. */ export type ValidationResult = { errors: string[]; warnings: string[]; };