float angle = 0.0; float stepSize = 0.15; int halfHeight, thirdHeight, sixthHeight, interval, startX, endX; float proportion = 0.0; float anoise = 0.0; void setup() { size(640,480); lights(); noStroke(); halfHeight = height/2; thirdHeight = height/3; sixthHeight = height/6; interval = width/128; startX = width/10; endX = width - width/10; } void loop() { background(180,180,190); for (int i = startX; i < endX; i+=interval) { proportion = float(i)/width; anoise = 2*sin(proportion*PI); push(); translate(i,halfHeight); rotateX(angle*proportion); rotateY(angle*proportion); rotateZ(angle*proportion); box(2,thirdHeight,2); pop(); } if (!mousePressed) { angle+=stepSize*(mouseX-(width*0.5))/(width*0.5); } if (angle >= width*TWO_PI) { angle = 0.0; } } void mouseClicked() { stepSize*=-1.0; }