A beautiful React application featuring animated text flowing along a custom SVG path, built with GSAP, TypeScript, and Tailwind CSS.
- Smooth Text Animation: Characters flow seamlessly along a custom SVG path using GSAP MotionPath
- Interactive Controls: Hover over the animation to pause/resume
- Dark/Light Theme: Toggle between themes with smooth transitions
- Responsive Design: Optimized for mobile, tablet, and desktop viewing
- Paper Texture: Authentic paper background with theme-specific blend modes
- Performance Optimized: Efficient character spacing and animation management
- React 18 with TypeScript
- GSAP (GreenSock Animation Platform)
- MotionPathPlugin for path-based animations
- SplitText for character manipulation
- Tailwind CSS for styling and responsive design
- Vite for fast development and building
- Context API for theme management
- Node.js (v18 or higher)
- npm or yarn
- Clone the repository:
git clone <your-repo-url>
cd type-on-path- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser and navigate to
http://localhost:5173
Edit the text content in src/components/TextOnPath.tsx:
<p ref={textRef}>
Your custom text here...
</p>The SVG path can be modified in the <path> element within TextOnPath.tsx. Use any SVG path editor or create custom paths programmatically.
Modify the animation duration in the GSAP configuration:
const animation = gsap.to(char, {
duration: 200, // Adjust this value
repeat: -1,
ease: "none",
// ... other properties
});Update theme colors in src/lib/theme.ts and corresponding Tailwind classes throughout the components.
src/
├── components/
│ ├── TextOnPath.tsx # Main animation component
│ └── ThemeToggle.tsx # Theme switcher
├── contexts/
│ └── ThemeContext.tsx # Theme state management
├── lib/
│ └── theme.ts # Theme utilities
├── styles/
│ └── grid.css # Grid layout styles
├── assets/
│ ├── Texturelabs_Paper_154XL.jpg
│ └── yoga.png
└── App.tsx # Main application component
- Splits text into individual characters
- Animates each character along the SVG path
- Handles hover interactions for play/pause
- Manages animation cleanup
- Context-based theme management
- Smooth transitions between light/dark modes
- Theme-specific image treatments and blend modes
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
This project is open source and available under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.
This project demonstrates advanced web animations and serves as an example of how to create engaging user experiences with modern web technologies.
Built with ❤️ using React, GSAP, and TypeScript