/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.K73ugYihsiw/rev.496
*
* authors:
* Matt Perkins
* 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 imax = 2500;
PVector lasties;
void setup() { // this is run once.
lasties = new PVector(0,0);
// set the background color
background(255);
// canvas size (Variable aren't evaluated. Integers only, please.)
size(300, 300);
// smooth edges
smooth();
// limit the number of frames per second
frameRate(30);
// set the width of the line.
strokeWeight(1);
imax = (height+50)/.2;
}
void draw() { // this is run repeatedly.
// set the color
stroke(0, random(i%255), random(i%255), 5);
translate(width/2,height/2);
//set up some "parametric equations"
int leftx = (i * .1) * cos(((5*i)/imax ) * TWO_PI);
int lefty = (i * .1) * sin(((5*i)/imax ) * TWO_PI);
int rightx = (i * .15) * cos(((5*i)/imax ) * TWO_PI);
int righty = (i * .15) * sin(((5*i)/imax ) * TWO_PI);
for(j=0;j<64;j++)
{
int newX = random(leftx,rightx);
int newY = random(lefty,righty);
// draw the line
line(lasties.x, lasties.y, newX, newY);
lasties.x = newX;
lasties.y = newY;
}
// move over a pixel
if (i < imax) {
i++;
} else {
i = 0;
}
}