Installation
ParticleText.js is a standalone vanilla JavaScript library with no dependencies. You can install it in multiple ways depending on your project setup.
CDN (Recommended for Quick Start)
Section titled “CDN (Recommended for Quick Start)”The fastest way to get started is to include ParticleText.js via CDN:
<!DOCTYPE html><html><head> <title>My ParticleText Project</title></head><body> <canvas id="particle-canvas" data-text="ParticleText.js"></canvas>
<!-- Include ParticleText.js from CDN --> <script src="https://cdn.jsdelivr.net/gh/aayusharyan/particleText.js@main/src/particleText.js"></script>
<script> initParticleJS('#particle-canvas', { colors: ['#695aa6'], fontSize: 100 }); </script></body></html>Install via npm for use in bundled projects:
npm install particletext-jspnpm add particletext-jsyarn add particletext-jsThen import in your JavaScript:
import { initParticleJS } from 'particletext-js';
initParticleJS('#particle-canvas', { colors: ['#695aa6'], fontSize: 100});Direct Download
Section titled “Direct Download”- Download
particleText.jsfrom the GitHub repository - Place it in your project directory
- Include it in your HTML:
<script src="path/to/particleText.js"></script>Requirements
Section titled “Requirements”ParticleText.js has minimal requirements:
- Browser Support: IE11+, Chrome, Firefox, Safari, Edge
- Dependencies: None - Pure vanilla JavaScript
- HTML5 Canvas: Required (supported by all modern browsers)
Verify Installation
Section titled “Verify Installation”To verify ParticleText.js is loaded correctly, open your browser’s developer console and type:
console.log(typeof initParticleJS); // Should output: "function"If you see "function", you’re ready to go!
Next Steps
Section titled “Next Steps”- Quick Start Guide - Create your first particle text animation
- Basic Usage - Learn the fundamentals
- Configuration Reference - Explore all options
Troubleshooting
Section titled “Troubleshooting”Script Not Loading
Section titled “Script Not Loading”If initParticleJS is undefined:
- Check that the script tag is before your initialization code
- Verify the CDN URL or file path is correct
- Check browser console for 404 errors
Canvas Not Found
Section titled “Canvas Not Found”If you see “Canvas element not found”:
- Ensure your canvas has the correct
idattribute - Make sure the canvas element exists in the HTML before running the script
- Check that your selector (e.g.,
#particle-canvas) matches the canvas ID
For more help, visit the Troubleshooting Guide.