/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.OKyl5hCZgDs/rev.512
*
* authors:
* Steven Calderon
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
void setup() {
colorMode(HSB,360,100,100);
size(400,400);
smooth();
}
bool followMouse = false;
void draw() {
background(0,0,0);
stroke(random(100,360),80,100);//set the color
for(int x=0; x<=width; x=x+5) {
//float y = (sin(radians(x+frameCount))*170)+(height/2);
float y = (sin(radians(x+frameCount))*170)+(height/2);
//line(x,y,mouseX,mouseY);
//line(x,y,10,10);
//line(x,y,mouseX,(height/2));
if(followMouse){
line(x,y,mouseX,mouseY);
}else{
line(x,y,(width/2),(height/2));
}
}
}
void mousePressed(){
followMouse = !followMouse;
}