import traer.physics.*; ParticleSystem physics; Particle last; void setup() { size( 400, 400 ); fill( 255, 64 ); framerate( 24 ); physics = new ParticleSystem( -0.1, 0.001 ); ellipseMode( CENTER ); smooth(); cursor( CROSS ); } void draw() { for ( int i = 0; i < 5; i++ ) { Particle p = physics.makeParticle( 1.0f, mouseX, mouseY, 0 ); p.setVelocity( random( -1, 1 ), random( -2, -5 ), 0 ); if ( last != null ) physics.makeSpring( p, last, 0.1f, 0.1f, 10 ); last = p; } physics.tick(); background( 255 ); noStroke(); for ( int i = 0; i < physics.numberOfParticles(); ++i ) { Particle p = physics.getParticle( i ); fill( 0, 255/(p.age()+1) ); ellipse( p.position().x(), p.position().y(), 20, 20 ); if ( p.age() > 96 ) p.kill(); } }