/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.oXWsk$MAJNi/rev.12
*
* authors:
* Scott Smith
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
boolean clockwise = true;
int a;
void setup() {
background(255);
size(300, 300);
smooth();
frameRate(30);
strokeWeight(12);
PFont fontA = loadFont("Arial");
textFont(fontA, 12);
}
void draw() {
rectMode(CENTER);
rect(width/2, width/2, 56, 56);
fill(0);
text("reverse", 130, 155);
if (clockwise) {
a = 1;
}
else {
a = -1;
}
stroke(abs(255*sin(millis()/543)),
abs(100*sin(millis()/767)),
abs(255*sin(millis()/1000)), millis()/10);
fill(abs(255*sin(millis()/543)),
abs(100*sin(millis()/767)),
abs(100*sin(millis()/1000)), sin(millis())/10);
ellipse(0.5*width + 100*cos(a*millis()/500),
0.5*width + 100*sin(a*millis()/500),
abs(100*sin(millis()/237)),
abs(100*sin(millis()/237)));
}
void mouseClicked() {
if ( mouseX > 122 && mouseX < 178 && mouseY > 122 && mouseY < 178 ) {
clockwise = !clockwise;
}
}