int thingCount = 20; Thing[] things; int frameCounter = 1; int speed = 12; float worldSize; int colorFg = 255; int colorBg = 0; void setup() { size(320, 240); noStroke(); background(colorBg); smooth(); frameRate(25); worldSize = random(20,100); things = new Thing[thingCount]; for (int i=0; i= speed) { beatIt(); } background(colorBg); for (int i=0; i 360) { rotationAngel -= 360; } rotationAngelArc = rotationAngel * PI / 180; x3 = x + Size/2.2 * cos(rotationAngelArc); y3 = y + Size/2.2 * sin(rotationAngelArc); x4 = (x + Size/2.2 * cos(rotationAngelArc)) - Size; pushMatrix(); translate(xCenter,yCenter); rotate(direction); stroke(colorFg, opacity); strokeCap(CORNER); strokeWeight(Size*0.2); line(x3, y3, x, y); // wheel center to piston attachment line(x4, y, x3, y3); // piston line(x4, y, x4-Size/2, y); // piston two noStroke(); fill(colorFg, opacity); ellipse(x4, y, Size/5, Size/5); // piston attachment end ellipse(x, y, Size/4, Size/4); // center wheel ellipse(x, y, Size, Size); // inner wheel ellipse(x, y, Size*1.2, Size*1.2); // outer wheel ellipse(x3, y3, Size/3, Size/3); // piston attachment wheel popMatrix(); } }