/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.zYD2H29ebny/rev.491
*
* authors:
* Stuart Allen
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// Pressing Control-R will render this sketch.
int i = 0;
int range = 100;
void setup() { // this is run once.
// set the background color
background(255);
// canvas size (Variable aren't evaluated. Integers only, please.)
size(400, 400);
// smooth edges
smooth();
// limit the number of frames per second
frameRate(30);
// set the width of the line.
strokeWeight(12);
}
void draw() { // this is run repeatedly.
stroke(random(50),random(50),random(255),100);
line(width/2 + range*cos(2*Math.PI*i/200),
height/2 + range*sin(2*Math.PI*i/50),
50,
50);
line(width/2 + -range*cos(2*Math.PI*-i/200),
height/2 + -range*sin(2*Math.PI*-i/50),
width - 50,
50);
stroke(0,0,random(255),255);
line(width/2 + range*cos(2*Math.PI*i/200),
height/2 + range*sin(2*Math.PI*i/50),
width/2 + range*cos(2*Math.PI*i/200),
height/2 + range*sin(2*Math.PI*i/50));
line(width/2 + -range*cos(2*Math.PI*-i/200),
height/2 + -range*sin(2*Math.PI*-i/50),
width/2 + -range*cos(2*Math.PI*-i/200),
height/2 + -range*sin(2*Math.PI*-i/50));
fill(255,255,255,10);
rect(0,
0,
width,
height);
// move over a pixel
if (i < width) {
i++;
} else {
i = 0;
}
}