0.0.6 • Published 9 months ago

@reactopia/svg-animator v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@reactopia/svg-animator 🎨✨

A professional SVG text animation library with React support. Create stunning text animations with ease!

npm version License: MIT

Features

  • 🚀 Lightweight and performant
  • ⚛️ React-first design
  • 🎯 Full TypeScript support
  • 🔄 SSR compatible
  • 🎨 Customizable animations
  • 📦 Simple API
  • 🎭 Built-in font support
  • 👀 Intersection Observer support

Installation

Using pnpm:

pnpm add @reactopia/svg-animator

Using npm:

npm install @reactopia/svg-animator

Using bun:

bun add @reactopia/svg-animator

Basic Example

import { AnimatedText } from '@reactopia/svg-animator';

const App = () => {
  return (
    <AnimatedText
      text="Hello World!"
      font="Pinyon Script"
      textConfig={{
        x: "50%",
        y: "50%",
        textAnchor: "middle",
        dominantBaseline: "middle",
        fontSize: "48px"
      }}
    />
  );
}

With Custom Animation

import { AnimatedText } from '@reactopia/svg-animator';
   
const App = () => {
 return (
   <AnimatedText
     text="Animated Text"
     font="Dancing Script"
     textConfig={{
       x: "50%",
       y: "50%",
       textAnchor: "middle",
       fontSize: "64px"
     }}
     animationConfig={{
       duration: 3000,
       delay: 500,
       strokeColor: "#ff0000",
       fillColor: "#000000",
       strokeWidth: 2
     }}
     onAnimationStart={() => console.log('Animation started')}
     onAnimationEnd={() => console.log('Animation completed')}
   />
 );
}

Configuration Options

TextConfig

PropertyTypeDefaultDescription
xstring | numberrequiredX coordinate of the text
ystring | numberrequiredY coordinate of the text
fontSizestringundefinedFont size of the text
textAnchor'start' | 'middle' | 'end'undefinedText anchor alignment
dominantBaseline'auto' | 'middle' | 'hanging'undefinedVertical text alignment

AnimationConfig

PropertyTypeDefaultDescription
durationnumber2000Animation duration in milliseconds
delaynumber0Delay before animation starts
easingstring'ease'CSS animation timing function
iterationsnumber1Number of animation iterations
direction'normal' | 'reverse' | 'alternate' | 'alternate-reverse''normal'Animation direction
fillMode'none' | 'forwards' | 'backwards' | 'both''forwards'CSS animation fill mode
strokeWidthnumber2Width of the text stroke
strokeColorstring'#000000'Color of the text stroke
fillColorstring'#000000'Fill color of the text

Supported Fonts

  • Pinyon Script
  • Dancing Script
  • Pacifico

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © Yash Mahajan

Support

If you like this project, please consider supporting it by:

  • ⭐ Starring the repository
  • 🐛 Reporting bugs
  • 🔥 Contributing to the code
  • Buying me a coffee
0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago