Text Animation

The Text Animation - a component that brings your text to life with smooth, customizable animations. Whether you want to animate characters, words, or entire lines, this component has got you covered. It's like having a personal animator for your text content!

Preview
Code

Installation

First, make sure you have the required dependencies:

npx vynk add text-animation
yarn vynk add text-animation
pnpm dlx vynk add text-animation
bunx --bun vynk add text-animation

Usage

Here's how to bring your text to life:

import { TextAnimation } from "@/components/ui/text-animation"

// Your component
const MyComponent = () => {
  return (
    <TextAnimation
      text="Hello, World!"
      by="chars"
      direction="bottom"
      blur={true}
      fade={true}
    />
  )
}

Props

The component comes with a variety of animation options:

PropTypeRequiredDescription
textstringYesThe text content to animate
classNamestringNoAdditional CSS classes for custom styling
delaynumberNoInitial delay before animation starts (in seconds)
durationnumberNoDuration of the animation (in seconds)
startDelaynumberNoDelay before the animation sequence begins
staggerChildrennumberNoDelay between each element's animation
by'words' | 'chars' | 'lines' | 'none'NoHow to split the text for animation
blurbooleanNoWhether to include blur effect in animation
fadebooleanNoWhether to include fade effect in animation
ease'easeInOut' | 'easeIn' | 'easeOut'NoAnimation easing function
direction'top' | 'bottom' | 'right' | 'left'NoDirection of the animation
animationDirection'default' | 'reverse'NoWhether to animate from start to end or vice versa

Animation Variations

Here are some examples of different animation styles you can create:

Word-by-Word Animation

Preview
Code

Character-by-Character Animation

Preview
Code

Line-by-Line Animation

Preview
Code

No Animation Split

Preview
Code

Features

  • Multiple Animation Modes: Animate by characters, words, lines, or as a whole
  • Customizable Effects: Combine blur and fade effects for stunning results
  • Directional Control: Animate from any direction
  • Timing Control: Fine-tune delays and durations
  • Responsive Design: Looks great on all screen sizes

Common Issues

  1. "The animation isn't starting!" - Check if you've provided the required text prop

  2. "The animation looks choppy!" - Try adjusting the duration and staggerChildren values

  3. "The text is not splitting correctly!" - Verify the by prop matches your intended animation style

Contributing

Found a bug or have an improvement in mind? We welcome your contributions! Just make sure your code follows our standards and includes appropriate tests.

The Text Animation component is your go-to solution for adding that extra flair to your text content! ✨