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

@gergelybardos/gnist

v0.1.1

Published

Lightweight, renderer-agnostic particle simulation engine built with vanilla JavaScript for real-time visual effects

Readme

Gnist

node license

⚠️ Important: This project is currently in early development. APIs are not stable yet, and breaking changes should be expected.

📚 Table of Contents

ℹ️ About Gnist

Gnist is a lightweight particle simulation engine.

Designed for real-time visual effects rather than physically accurate simulations, it uses a simplified kinematic model optimized for performance over strict Newtonian mechanics. Particles bypass mass and momentum calculations; instead, forces directly influence acceleration.

Key Characteristics:

  • Renderer-agnostic: The engine is decoupled from timing and rendering loops, making it reusable across different runtimes and rendering systems.
  • Zero-dependency: Gnist is written in vanilla JavaScript with no external runtime dependencies. Full TypeScript support is provided via declaration files.

📋 Requirements

To install and integrate the NPM package into your own project, your environment should support:

📦 Installation

npm i @gergelybardos/gnist

💡 Note: Gnist is distributed as native ECMAScript Modules (ESM) with no build step, preserving a fully readable source in node_modules and enabling consumer bundlers to optimize tree-shaking and minification.

⚡ Basic Usage

Gnist is renderer-agnostic; the client is responsible for implementing the main update loop and rendering using their chosen rendering system. The example below shows the minimal setup required to run Gnist.

<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
  <body>
    <canvas id="canvas" width="800" height="600"></canvas>
    <script type="module" src="main.js"></script>
  </body>
</html>
// main.js
// TODO: Import Gnist classes

const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

// TODO: Initialize Gnist and an emitter

let lastTime = performance.now();

function loop(currentTime) {
    requestAnimationFrame(loop);

    const dt = (currentTime - lastTime) / 1000;
    lastTime = currentTime;

    ctx.fillStyle = '#000';
    ctx.fillRect(0, 0, canvas.width, canvas.height);
    
    // TODO: Update Gnist and render particles
}
requestAnimationFrame(loop);

The complete version looks like this:

// main.js
// 1. Import Gnist classes
import { Gnist, PointEmitter } from '@gergelybardos/gnist';

const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

// 2. Initialize Gnist and an emitter
const engine = new Gnist();
const emitter = new PointEmitter({
    x: canvas.width / 2,
    y: canvas.height / 2,
    particlesPerSecond: 100,
    particleBlueprint: {
        color: {r: 255, g: 0, b: 0},
        lifespan: [1, 3],
        speed: [15, 150],
        direction: [0, Math.PI * 2],
    }
});
engine.addEmitter(emitter);

let lastTime = performance.now();

function loop(currentTime) {
    requestAnimationFrame(loop);

    const dt = (currentTime - lastTime) / 1000;
    lastTime = currentTime;

    ctx.fillStyle = '#000';
    ctx.fillRect(0, 0, canvas.width, canvas.height);
    
    // 3. Update Gnist
    engine.update(dt);

    // 4. Render particles
    const particles = engine.getParticles();
    for (let i = 0; i < particles.length; i++) {
        const p = particles[i];
        const { r, g, b } = p.color;
        ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
        ctx.fillRect(p.x - 1, p.y - 1, 2, 2);
    }
}
requestAnimationFrame(loop);

This is a minimal example; real applications typically extend it with additional rendering and control logic.

⚙️ Core Features

  • Emitters: Define and control particle spawning behavior with emission rate, lifespan, size, and more.
  • Forces: Apply forces such as gravity (DirectionalForce) or friction (LinearDrag) globally to the whole system or scoped to specific emitters.
  • Modifiers: Transform particle visuals over time with support for linear color gradients (ColorRamp) and opacity transitions (OpacityFade).

📖 Documentation

Gnist provides comprehensive resources to help you get started and master the engine:

  • How-To Guides — Step-by-step tutorials on how to use Gnist in real projects.
  • API Reference — Technical specification of the public-facing API, including core classes, components, and configuration interfaces.

🤝 Contributing

See Contributing Guide for details.

📜 License

Gnist is open-source software licensed under the MIT license.