/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://dflab.sketchpad.cc/sp/pad/view/ro.UbKLLrJUnmy/rev.88
*
* authors:
* Rita Isabel Pardal
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
float px = 0;
float py = 150;
float vx = 1;
float amplitude = 40;
float freq = 0.9;
float t;
void setup() {
size(200, 200);
background(150,200,100);
stroke (0,5);
strokeWeight(5);
}
void draw() {
// background(255);
t = millis() / 1000.0;
float npx = px + vx;
float npy = 150 + (amplitude * sin (t * TWO_PI * freq));
line (px, py, npx, npy);
px = npx;
py = npy;
if (px > width) {
px = 0;
}
}