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

net-particles

v0.9.81

Published

html5 canvas js network interactive particle effects

Downloads

12

Readme

Net Particles

Yet another HTML5 Canvas particle network animation*, **

*CURRENTLY IN PRE-PRE-RELEASE **AKA WORK TO BE DONE

CODEPEN DEMO https://codepen.io/nnyath/pen/QqQMLW

Inspired by the likes of Canvas Particle Network and multitude of other point network animations out there. This one stands out (slightly) with the following

  • Modern ES Module Implementation
  • Multiple customizable, particle network animation layer support
  • Optional automatic canvas resizing
  • Included dev environment

Install

Use your favorite package manager

yarn add net-particles
-or-
npm install net-particles

Default Usage

NetParticles's default animation implementation works by simply providing the Canvas's DOM element.

Start by adding the default dependency to your JS file

// The ES6 Way
import NetParticles from 'net-particles'

-or-

// The CommonJS Way
var NetParticles = require('net-particles').NetParticle

Then create a new instance of NetParticle with the Canvas element as an argument. Initialize the object via init() and begin the animation via play()

let NetP = new NetParticles(document.getElementById('CanvasID'))
NetP.init()
NetP.play()

Pausing the Animation (New Feature! 🔥)

Simply pause/unpause using a toggle for NetParticles object with.

Perfect for saving resources when the canvas is out of viewport (though you have to hook up your own way to detect it using something like emergence.js)

NetP.togglePause()

Customizing Quickstart

Start customizing by adding the additional object type

// The ES6 Way
import {NetParticles, ParticleNetwork} from 'net-particles'

-or-

// The CommonJS Way
var NetParticles = require('net-particles').NetParticles
var ParticleNetwork = require('net-particles').ParticleNetwork

Create an array of ParticleNetworks using the targetted Canvas element and customized options. Add them to the NetParticle controller


let CanvasEl = document.getElementById('CanvasID')

let PN1 = new ParticleNetwork(CanvasEl, { color:red, velocity:{ x:3, y:3 } })
let PN2 = new ParticleNetwork(CanvasEL, { color:blue, opacity:.5 })
let PN3 = new ParticleNetwork(CanvasEL)

let PNArray = [PN1,PN2,PN3]

let NetP = new NetParticle(CanvasEL, PNArray)

Init and Play

NetP.init()
NetP.play()

Options

NetParticle can be customized in these ways (with more ways coming in the future) via the config object passed to ParticleNetwork's arguments

max_particles

Total number of particles in the ParticleNetwork

{max_particles : INT }

velocity

Point's X and Y velocity base modifier

{x: DOUBLE, y: DOUBLE}

color

Point's color (uses CSS values)

{color : STRING}

opacity

Point's opacity. Should be less than 1

{opacity : DOUBLE}

radius

Point's radius (affects size)

{radius : INT || DOUBLE}

offset

Offset used to calculate bouncing back from the edge of the canvas (in pixels)

{offset : INT}

License

The MIT License (MIT) Copyright (c) 2017 Kenny Inthirath