Skip to content

Installation

ParticleText.js is a standalone vanilla JavaScript library with no dependencies. You can install it in multiple ways depending on your project setup.

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:

Terminal window
npm install particletext-js

Then import in your JavaScript:

import { initParticleJS } from 'particletext-js';
initParticleJS('#particle-canvas', {
colors: ['#695aa6'],
fontSize: 100
});
  1. Download particleText.js from the GitHub repository
  2. Place it in your project directory
  3. Include it in your HTML:
<script src="path/to/particleText.js"></script>

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)

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!

If initParticleJS is undefined:

  1. Check that the script tag is before your initialization code
  2. Verify the CDN URL or file path is correct
  3. Check browser console for 404 errors

If you see “Canvas element not found”:

  1. Ensure your canvas has the correct id attribute
  2. Make sure the canvas element exists in the HTML before running the script
  3. Check that your selector (e.g., #particle-canvas) matches the canvas ID

For more help, visit the Troubleshooting Guide.