import gifAnimation.*; import traer.physics.*; PImage small; ParticleSystem physics; Particle one; Particle two; Particle three; Particle four; Particle stuck; float susan = 100; Spring aa; Spring bb; Spring cc; Spring dd; Spring ee; Spring ff; Spring it; Spring is; Spring quite; Spring cool; //ParticleSystem physics; Particle thing; Particle myThing; Particle another; Particle theThing; Particle thing2; Particle thing3; Particle thing4; Particle thing5; Particle thing6; Particle thing7; Particle thing8; Particle thing9; Particle thing10; Particle thing11; Particle thing12; Particle thing13; Spring s; Spring p; Spring q; Spring a; Spring b; Spring c; Spring d; Spring e; Spring f; Spring g; Spring h; Spring i; Spring j; Spring k; Spring l; Spring m; Spring n; Spring o; Spring u; Spring v; Spring w; Spring x; Spring y; Spring z; void setup() { size( 600, 600 ); smooth(); fill( 255); frameRate( 24 ); ellipseMode( CENTER ); physics = new ParticleSystem (5.5, 0.5); myThing = physics.makeParticle( 3.0, 300, 100, 0); thing = physics.makeParticle( 1.0, 166, 100, 0); another = physics.makeParticle(1.0, 223, 100,0); theThing = physics.makeParticle(1.0, 100, 100, 0); thing2 = physics.makeParticle(1.0, 100, 166, 0); thing3 = physics.makeParticle(1.0, 166, 166 , 0); thing4 = physics.makeParticle(1.0, 233, 166, 0); thing5 = physics.makeParticle(1.0, 300, 166, 0); thing6 = physics.makeParticle(1.0, 100, 233, 0); thing7 = physics.makeParticle(1.0, 166, 233, 0); thing8 = physics.makeParticle(1.0, 233, 233, 0); thing9 = physics.makeParticle(1.0, 300, 233, 0); thing10 = physics.makeParticle(1.0, 100, 300, 0); thing11 = physics.makeParticle(1.0, 166, 300, 0); thing12 = physics.makeParticle(1.0, 223, 300, 0); thing13 = physics.makeParticle(1.0, 300, 300, 0); myThing.makeFixed(); theThing.makeFixed(); s = physics.makeSpring( myThing, thing, 1.0, 0.1, 100 ); q = physics.makeSpring( thing, another, 1.0, 0.1, 100); p = physics.makeSpring( another, theThing, 1.0, 0.1, 100 ); a = physics.makeSpring( myThing, thing2, 1.0, 0.1, 100 ); b = physics.makeSpring( thing, thing3, 1.0, 0.1, 100 ); c = physics.makeSpring( another, thing4 , 1.0, 0.1, 100 ); d = physics.makeSpring( thing5, theThing, 1.0, 0.1, 100 ); e = physics.makeSpring( thing2, thing3, 1.0, 0.1, 100 ); f = physics.makeSpring( thing3, thing4, 1.0, 0.1, 100 ); g = physics.makeSpring( thing4, thing5, 1.0, 0.1, 100 ); h = physics.makeSpring( thing2, thing6, 1.0, 0.1, 100 ); i = physics.makeSpring( thing3, thing7, 1.0, 0.1, 100 ); j = physics.makeSpring( thing4, thing8, 1.0, 0.1, 100 ); k = physics.makeSpring( thing5, thing9, 1.0, 0.1, 100 ); l = physics.makeSpring( thing6, thing7, 1.0, 0.1, 100 ); m = physics.makeSpring( thing7, thing8, 1.0, 0.1, 100 ); n = physics.makeSpring( thing8, thing9, 1.0, 0.1, 100 ); o = physics.makeSpring( thing6, thing10, 1.0, 0.1, 100 ); u = physics.makeSpring( thing7, thing11, 1.0, 0.1, 100 ); v = physics.makeSpring( thing8, thing12, 1.0, 0.1, 100 ); w = physics.makeSpring( thing9, thing13, 1.0, 0.1, 100 ); x = physics.makeSpring( thing10, thing11, 1.0, 0.1, 100 ); y = physics.makeSpring( thing11, thing12, 1.0, 0.1, 100 ); z = physics.makeSpring( thing12, thing13, 1.0, 0.1, 100 ); physics.makeAttraction( myThing, thing, -7000, 5 ); physics.makeAttraction( thing, another, -7000, 5 ); physics.makeAttraction( theThing, another, -7000, 5 ); //physics.makeAttraction( theThing, another, -7000, 5 ); physics = new ParticleSystem (5.5, 0.5); one = physics.makeParticle( 3.0, susan, susan, 0); two = physics.makeParticle( 3.0, susan, susan, 0); three = physics.makeParticle( 3.0, susan, susan, 0); four = physics.makeParticle( 3.0, susan, susan, 0); stuck = physics.makeParticle(3.0, susan, susan, 0); one.makeFixed(); aa = physics.makeSpring( one, two, 1.0, 0.1, 70 ); bb = physics.makeSpring( one, three, 1.0, 0.1, 60 ); cc = physics.makeSpring( one, four, 1.0, 0.1, 50 ); dd = physics.makeSpring( two, three, 1.0, 0.1, 40 ); ee = physics.makeSpring( two, four, 1.0, 0.1, 30 ); ff = physics.makeSpring( three, four, 1.0, 0.1, 100 ); it = physics.makeSpring( stuck, one, 1.0, 0.1, 100 ); is = physics.makeSpring( stuck, two, 1.0, 0.1, 100 ); quite = physics.makeSpring( stuck, three, 1.0, 0.1, 100 ); cool = physics.makeSpring( stuck, four, 1.0, 0.1, 100 ); } void draw() { if ( !mousePressed ) physics.advanceTime( 1.0 ); else { myThing.moveTo( mouseX, mouseY, 0 ); myThing.setVelocity( (mouseX - pmouseX), (mouseY - pmouseY), 1 ); physics.advanceTime( 1.0); one.moveTo( mouseX, mouseY, 0 ); one.setVelocity( (mouseX - pmouseX), (mouseY - pmouseY), 1 ); } // background (255); ellipse(myThing.position().x(), myThing.position().y(),25, 25); ellipse(thing.position().x(), thing.position().y(), 20, 20); ellipse(another.position().x(), another.position().y(), 20, 20); ellipse(theThing.position().x(), theThing.position().y(), 5, 5); ellipse(thing2.position().x(), thing2.position().y(), 20, 20); ellipse(thing3.position().x(), thing3.position().y(), 20, 20); ellipse(thing4.position().x(), thing4.position().y(), 20, 20); ellipse(thing5.position().x(), thing5.position().y(), 20, 20); ellipse(thing6.position().x(), thing6.position().y(), 20, 20); ellipse(thing7.position().x(), thing7.position().y(), 20, 20); ellipse(thing8.position().x(), thing8.position().y(), 20, 20); ellipse(thing9.position().x(), thing9.position().y(), 20, 20); ellipse(thing10.position().x(), thing10.position().y(), 20, 20); ellipse(thing11.position().x(), thing11.position().y(), 20, 20); ellipse(thing12.position().x(), thing12.position().y(), 20, 20); ellipse(thing13.position().x(), thing13.position().y(), 20, 20); noFill(); beginShape(); curveVertex(myThing.position().x(), myThing.position().y()); curveVertex(myThing.position().x(), myThing.position().y()); curveVertex(thing.position().x(), thing.position().y()); curveVertex(another.position().x(), another.position().y()); curveVertex(theThing.position().x(), theThing.position().y()); curveVertex(theThing.position().x(), theThing.position().y()); endShape(); noFill(); beginShape(); curveVertex(thing2.position().x(), thing2.position().y()); curveVertex(thing2.position().x(), thing2.position().y()); curveVertex(thing3.position().x(), thing3.position().y()); curveVertex(thing4.position().x(), thing4.position().y()); curveVertex(thing5.position().x(), thing5.position().y()); curveVertex(thing5.position().x(), thing5.position().y()); endShape(); noFill(); beginShape(); curveVertex(thing6.position().x(), thing6.position().y()); curveVertex(thing6.position().x(), thing6.position().y()); curveVertex(thing7.position().x(), thing7.position().y()); curveVertex(thing8.position().x(), thing8.position().y()); curveVertex(thing9.position().x(), thing9.position().y()); curveVertex(thing9.position().x(), thing9.position().y()); endShape(); noFill(); beginShape(); curveVertex(thing10.position().x(), thing10.position().y()); curveVertex(thing10.position().x(), thing10.position().y()); curveVertex(thing11.position().x(), thing11.position().y()); curveVertex(thing12.position().x(), thing12.position().y()); curveVertex(thing13.position().x(), thing13.position().y()); curveVertex(thing13.position().x(), thing13.position().y()); endShape(); noFill(); beginShape(); curveVertex(myThing.position().x(), myThing.position().y()); curveVertex(myThing.position().x(), myThing.position().y()); curveVertex(thing2.position().x(), thing2.position().y()); curveVertex(thing6.position().x(), thing6.position().y()); curveVertex(thing10.position().x(), thing10.position().y()); curveVertex(thing10.position().x(), thing10.position().y()); endShape(); noFill(); beginShape(); curveVertex(thing.position().x(), thing.position().y()); curveVertex(thing.position().x(), thing.position().y()); curveVertex(thing3.position().x(), thing3.position().y()); curveVertex(thing7.position().x(), thing7.position().y()); curveVertex(thing11.position().x(), thing11.position().y()); curveVertex(thing11.position().x(), thing11.position().y()); endShape(); noFill(); beginShape(); curveVertex(another.position().x(), another.position().y()); curveVertex(another.position().x(), another.position().y()); curveVertex(thing4.position().x(), thing4.position().y()); curveVertex(thing8.position().x(), thing8.position().y()); curveVertex(thing12.position().x(), thing12.position().y()); curveVertex(thing12.position().x(), thing12.position().y()); endShape(); noFill(); beginShape(); curveVertex(theThing.position().x(), theThing.position().y()); curveVertex(theThing.position().x(), theThing.position().y()); curveVertex(thing5.position().x(), thing5.position().y()); curveVertex(thing9.position().x(), thing9.position().y()); curveVertex(thing13.position().x(), thing13.position().y()); curveVertex(thing13.position().x(), thing13.position().y()); endShape(); /* line(myThing.position().x(), myThing.position().y(), thing.position().x(), thing.position().y()); line(another.position().x(), another.position().y(), thing.position().x(), thing.position().y()); line(another.position().x(), another.position().y(), myThing.position().x(), myThing.position().y()); */ small = loadImage ("small.jpg"); image(small, one.position().x(), one.position().y()); image(small, two.position().x(), two.position().y()); image(small, three.position().x(), three.position().y()); image(small, four.position().x(), four.position().y()); }