npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

package-particlefx

v2.0.2

Published

A lightweight, framework-agnostic JavaScript library that renders interactive particle-based image hover effects using HTML5 canvas. Customize particle behavior with options like gravity, noise, mouse force, and more. Easily integrate into React, Vue, or

Downloads

119

Readme

package-particlefx

A lightweight, framework-agnostic JavaScript/TypeScript library that renders interactive particle-based image hover effects using <canvas>. Customize particle behavior with extensive options for physics, visual effects, and user interaction. Easily integrate into React, Vue, or plain HTML projects by passing a DOM container element.


🚀 What's New in 2.0.2

✨ Features

  • 🔧 New Project Structure

    • Fully rewritten in TypeScript for better type safety and developer experience.
    • Codebase reorganized into modular components within src/:
      • Canvas creation
      • Particle logic
      • Event handling
      • Configuration
  • ⚡ Modern Build System

    • Switched to Vite for blazing-fast builds.
    • Supports both ES and UMD bundles.
    • Introduced vite.config.ts.
  • 🧼 Code Quality Improvements

    • ESLint and Prettier integrated for a consistent and clean code style.
    • Added .eslintrc.js and .prettierrc.json.
  • 📦 Updated Dependencies

    • Development dependencies now include TypeScript, ESLint, Prettier, and Vite.

⚠️ Breaking Changes

  • The main entry point of the package has changed. Refer to the updated package.json for paths.
  • Internal APIs have been refactored for modularity — usage patterns may require updates.

Features

  • Image-to-Particles: Convert any image into animated particles
  • Dynamic Interactions: Particles respond to mouse hover, clicks, and vortex mode
  • Visual Customization: Filters (grayscale, sepia, invert), hue rotation, shapes
  • Framework Agnostic: Works with React, Vue, Angular, or vanilla JS
  • Highly Configurable: Tune physics, appearance, and behavior
  • Responsive: Adapts to container size
  • Image Download: Export canvas as PNG
  • TypeScript Support: Full types included
  • Lightweight: Zero dependencies, pure JS/TS

Installation

npm install package-particlefx

Quick Start

Vanilla JavaScript

import { createParticleCanvas } from 'package-particlefx';

const container = document.getElementById('my-container');
const particleCanvas = createParticleCanvas(container, {
  preset: 'fireworks',
  width: '100vw',
  height: '100vh',
});

particleCanvas.explodeParticles();
particleCanvas.resetParticles();
particleCanvas.downloadImage('my-particle-art.png');

React

import React, { useRef, useEffect, useState } from 'react';
import { createParticleCanvas } from 'package-particlefx';

function ParticleComponent() {
  const containerRef = useRef(null);
  const particleCanvasRef = useRef(null);
  const [config, setConfig] = useState({
    preset: 'galaxy',
    width: '100%',
    height: '400px',
  });

  useEffect(() => {
    if (containerRef.current) {
      particleCanvasRef.current = createParticleCanvas(containerRef.current, config);
    }

    return () => {
      particleCanvasRef.current?.destroy();
    };
  }, [config]);

  return (
    <div>
      <div ref={containerRef} style={{ width: '100%', height: '400px' }} />
      <button onClick={() => particleCanvasRef.current?.explodeParticles()}>Explode</button>
      <button onClick={() => particleCanvasRef.current?.resetParticles()}>Reset</button>
      <button onClick={() => particleCanvasRef.current?.downloadImage()}>Download</button>
      <button onClick={() => setConfig(prev => ({ ...prev, preset: 'snow' }))}>Change to Snow</button>
    </div>
  );
}

export default ParticleComponent;

Configuration Options

| Option | Type | Default | Description | | --------------- | -------------------------------------------- | ----------------- | ----------------------------------------------------------------- | | preset | 'fireworks' | 'snow' | 'galaxy' | 'rain' | undefined | Applies a pre-configured set of options. | | imageSrc | string | Built-in gradient | Path or data URL of the image to convert. | | width | number | string | 400 | Canvas width in pixels or a string with units (e.g., '100vw'). | | height | number | string | 400 | Canvas height in pixels or a string with units (e.g., '100vh'). | | particleGap | number | 4 | Spacing between particles (lower = more particles). | | mouseForce | number | 30 | Strength of mouse repulsion effect. | | gravity | number | 0.08 | Force pulling particles back to origin. | | noise | number | 10 | Random movement applied to particles. | | clickStrength | number | 100 | Force applied when clicking on canvas. | | hueRotation | number | 0 | Rotates the hue of particle colors (0-360 degrees). | | filter | 'none' | 'grayscale' | 'sepia' | 'invert' | 'none' | Applies a color filter to particles. | | particleShape | 'square' | 'circle' | 'triangle' | 'square' | Shape of individual particles. | | vortexMode | boolean | false | If true, clicks create a vortex effect instead of a ripple. |


API Reference

createParticleCanvas(container, options)

Creates a new particle canvas instance.

Returns: ParticleCanvas instance

ParticleCanvas Methods

  • resetParticles()
  • explodeParticles()
  • updateConfig(newOptions)
  • downloadImage(filename?: string)
  • destroy()
  • getParticleCount()
  • getConfig()
  • stopAnimation() / startAnimation()

Performance Tips

  • Use higher particleGap (4-8) for better performance.
  • Smaller images = faster loading.
  • Avoid full-screen canvas on mobile for performance.

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 12+
  • Edge 79+

License

MIT © Anmol Singh


Contributing

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