float rot = PI;
float d_rot = 0.05;
float xoff = 0.0;
float xincrement = 0.01;
//float xoff_xincrement = 0.05;
void setup() {
size(800, 800);
noStroke();
fill(255);
}
void draw() {
background(0);
translate(width/2, height/2);
rot += d_rot;
rotate( rot );
ellipse(0, 200, 40, 40);
rotate(radians(120));
ellipse(0, 200, 40, 40);
rotate(radians(120));
ellipse(0, 200, 40, 40);
// With each cycle, increment xoff
// Create an alpha blended background
fill(0, 10);
rect(0,0,width,height);
//float n = random(0,width); // Try this line instead of noise
// Get a noise value based on xoff and scale it according to the window’s width
float n = noise(xoff)*width;
// With each cycle, increment xoff
xoff += xincrement;
// Draw the ellipse at the value produced by perlin noise
fill(200);
ellipse(n,height/2, 64, 64);
}
// When the mouse is pressed,
void mousePressed(){
// If there is no rotation right now,
if( d_rot == 0 ){
// Start doing rotation.
d_rot = 0.03;
} else { // Or if there was some,
// Stop doing rotation.
d_rot = 0;
}
}