/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.7vDDvvXp21d/rev.189
*
* authors:
* alexq
* (Unnamed author)
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// This sketch builds on a prior work, "Untitled Sketch", created by alexq
// http://studio.sketchpad.cc/sp/pad/view/ro.9QMyHLDK-juIJ/rev.53
// Pressing Control-R will render this sketch.
int i = 0;
int j = 0;
int k = 0;
int cr, cg, cb, ca ;
int n1, n2 ;
int half_width = 0 ;
void setup() { // this is run once.
// set the background color
background(255);
// canvas size (Integers only, please.)
size(300, 300);
half_width = width / 2 ;
// smooth edges
smooth();
// limit the number of frames per second
frameRate(120);
// set the width of the line.
strokeWeight(5);
}
void draw() { // this is run repeatedly.
// set the color
cr = sin ( k * 0.0021293 ) * 127 + 127 ;
cg = sin ( k * 0.0038182 ) * 127 + 127 ;
cb = sin ( k * 0.0022135 ) * 127 + 127 ;
stroke( cr, cg, cb, 50);
// draw the line
n1 = ( sin ( k * 0.015433 ) * half_width + half_width ) ;
n2 = ( sin ( k * 0.03178 ) * half_width + half_width ) ;
line ( n2, 0, i, height ) ;
k++ ;
// move over a pixel
if ( i < width ) {
i++;
} else {
i = 0;
}
}