/** * The patricle system example with some modifications. *
  • Z-axis movement, scaling and colour *
  • ported to physics library *
  • particle draw with the mouse *
  • Aaron Bell Oct06. */ import traer.physics.*; ParticleSystem ps; boolean mouseMoved = false; void setup() { size(400,400); frameRate(30); colorMode(RGB,255,255,255,100); ellipseMode(CENTER); smooth(); noStroke(); // gravity, drag ps = new ParticleSystem(0.05, 0); } void mouseMoved() { mouseMoved = true; } void draw() { // mass, x, y, z Particle newP = ps.makeParticle( 1.0f, width/2, height/2, 0 ); newP.setVelocity(random(-2, 2), random(-3, 0), random(-1,1)); if (mouseMoved) { newP = ps.makeParticle( 1.0f, mouseX, mouseY, 0 ); newP.setVelocity(random(-2, 2), random(-3, 0), random(-1,1)); mouseMoved = false; } ps.tick(); background(0); for (int i=0; i= 100) p.kill(); } }