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

three-proto-particle

v0.0.3

Published

Very simple not quite particle system

Downloads

9

Readme

Proto Particle

Proto Particle is a really simple "particle system" It doesn't include any physics whatsoever, that up to you. It's basically just a system to efficiently render a ton of particles/geometries in Three JS. This code may also be a good start to experiment with Three JS BufferGeometries / InstancedBufferGeometries

Features

  • all particles are billboarded
  • spritemap support
  • use any geometry as particle
  • batched updates

coming soon to a particle near you

  • respecting normals
  • z-sorting
  • examples

how to particle

Creating the particle system

var Particles = require('three-proto-particle')

in it's easiest form with physics and 1024 particles

var particlesSystem = new Particle.System( 1024 )

just the geometry

var geometry = new Particle.Geometry( )
var geometry = new Particle.Geometry( 1024 )
var geometry = new Particle.Geometry( 1024, new THREE.PlaneBufferGeometry( 1, 1, 1, 1 ) )

just the material

var material = new Particle.BillboardMaterial( )
var material = new Particle.BillboardMaterial( { texture: THREE.ImageUtils.loadTexture("images/circle.png") })
var material = new Particle.BillboardMaterial( { texture: THREE.ImageUtils.loadTexture("images/circle.png"), columns: 2, rows: 2 })

just the mesh without bells and whistles

var particleMesh = new Particle.Mesh( geometry, material )

Adding / manipulating particles

just setting the position of a particle

particleSystem.addParticle( new THREE.Vector3( 1, 1, 1 ) )
particleSystem.addParticle( [1, 1, 1 ] )

setting position and custom attribute

particleSystem.addParticle( [1, 1, 1 ], { size: 2, opacity: 0.5, color: [ 0.5, 0.5, 1 ], sprite: 2 } )

just setting single attributes (translation and size) of a single particle (particle #45)

particleSystem.setAttribute( 'translate' , 45, [2, 0, 5] )
particleSystem.setAttribute( 'size' , 45, 2 )

setting an attribute (translation) for a bunch of particles

var translations = particleSystem.getAttributeArray('translation')
var sizes = particleSystem.getAttributeArray('size')

for( var i = 0; i < particleSystem.particleCount; i++ ) {
    /* keep in mind, that different attributes consist of different number of attributes,
    * e.g. x,y,z for translation and only s for size */
    translations[ i*3 + 0 ] = Math.random() // x
    translations[ i*3 + 1 ] = Math.random() // y
    translations[ i*3 + 2 ] = Math.random() // z

    sizes[ i ] = Math.random()
}

... more will come soon