public class Bongo { Particle p0; Particle p1; float xoff = 0.0; public Bongo(int x, int y) { p0 = physics.makeParticle( 1.0f, x, y, 0 ); p1 = physics.makeParticle( 1.0f, x, y, 0 ); p0.makeFixed(); p1.setVelocity(random( -0.01, 0.01 ), 0, 0 ); physics.makeSpring( p0, p1, .05, 0.1, random(50,100) ); //physics.makeSpring( p0, p1, .05, 0.1, 100 ); xoff = random(-100,100); } public void render() { xoff = xoff + .01; float n = 10 + noise(xoff) * 100; float r0 = 10/2; float r1 = n/2; //p1.setMass(n); float p0x = p0.position().x(); float p0y = p0.position().y(); float p1x = p1.position().x(); float p1y = p1.position().y(); float angle0 = atan2(p1y-p0y,p1x-p0y); float angle1 = angle0 - PI; stroke(255); //line(p0x+r0*sin(angle0),p0y+r0*cos(angle0),p1x,p1y);//p1x-r1*sin(angle1),p1y-r1*cos(angle1)); line(p0x,p0y,p1x,p1y); stroke(255,0,0); // line(p0x,p0y,p1x,p1y); stroke(255); ellipse(p0x,p0y,r0*2,r0*2); fill(n,n); ellipse(p1x,p1y,r1*2,r1*2); } }