import traer.physics.*; ParticleSystem physics; ParticleSystem physics2; Vector particles; Vector particles2; Particle last; Particle last2; float angle=0; void sprayOne(int i) { float angle = random( -PI, PI ); float x = cos(angle); float y = sin(angle*i); float v = 5; float f = radians(float(i)); float fx,fy,fz; fx=sin(f)*100.0f; fy=cos(f)*100.0f; fz=sin(f)*20.0f; Particle p = physics.makeParticle(1, fx,fy, fz ); p.setVelocity( x*v,v*y,x*v ); particles.add( p ); if ( last != null ) physics.makeSpring( p, last, 0.01, 0.001, 0 ); last = p; p = physics2.makeParticle(1, fx,fy, fz ); p.setVelocity( x*v,v*y,x*v ); particles2.add( p ); if ( last2 != null ) physics2.makeSpring( p, last2, 0.01, 0.001, 0 ); last2 = p; } void setup() { colorMode(RGB, 100); size( 800, 500 ); smooth(); // framerate( 100 ); noFill(); strokeWeight( .1 ); background(94,92,91); // noLoop(); physics2 = new ParticleSystem( 0.01,0.005 ); physics = new ParticleSystem( 0.0, 0.00001 ); particles = new Vector(); particles2 = new Vector(); physics.clear(); physics2.clear(); particles.clear(); particles2.clear(); // stroke(0,100); last = null; for ( int i = 0; i <= 360; i++ ) sprayOne(i); } void draw() { physics.advanceTime( 0.5 ); physics2.advanceTime( 0.5 ); stroke( 40,0,0,60); beginShape(LINE_STRIP); for ( int i = 0; i < particles.size(); ++i ) { Particle p = (Particle)particles.get( i ); curveVertex( 350+p.position().x(), 250+p.position().y() ); last = p; } endShape(); stroke( 94,92,91,60); beginShape(LINE_LOOP); for ( int i = 0; i < particles2.size(); ++i ) { Particle p = (Particle)particles2.get( i ); curveVertex( 350+p.position().x(), 250+p.position().y() ); last = p; } endShape(); }