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 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-particles

v1.1.2

Published

A simple particle system for NodeJs

Downloads

22

Readme

CircleCI Coverage Status npm version Node-Particles

This repository provides a simple, programatic way of defining a particle system in Javascript and use it in your NodeJs project (i.e. as a backend library).

The base functionality has been forked and adapted from JavaScript-Particle-System so if you are looking for a particle system for the browser that's the place to go. There is also a very nice article from the same author here.

Screenshots

Usage

The easiest way to get the library is to use npm:

npm install node-particles

Then from your scripts you can consume it using require:

var ns = require ("node-particles")

Quick Example

var np = require ("node-particles")

var ps = new np.ParticleSystem ();  // creates a new ParticleSystem instance

// Creates an Emitter at x:188,y:158 whose particles have a x:3,y:0 speed.
// Particles size is 15, ttl = -1, the position of the particle is jittered +/- 0.15 
// and 1 particle to be emitted on every cycle.
ps.addEmitter (new PS.Point(188,158), new PS.Point(3,0), 15, -1, 0.15, 1);

// Adds a field at x:254,y:211 with a mass of 500 (positive means attraction)
ps.addField (new PS.Point(243,211), 500);

// Adds a field at x:443,y:411 with a -5 mass (repulsion)
ps.addField (new PS.Point(443,411), -5);

// Run 10 cycles on the ParticleSystem. On each one the particles are generated
// and the previous ones position is updated.
ps.evolve(10);

ps.getParticles().forEach (function (p) {
  console.log(p.position); // displays each particle position
});

License

Please check the LICENSE file located at the root of this reposity.