/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://playgramming.sketchpad.cc/sp/pad/view/ro.bFqnaFxueYj/rev.22
*
* authors:
* Devon Scott-Tunkin
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// Processing Book, Casey Reas, pg. 282 Motion 1: Lines, Curves
float d = 20.0;
float speed = 1.0;
int direction = 1;
void setup() {
size(100, 100);
smooth();
noStroke();
fill(255, 204);
}
void draw() {
background(0);
ellipse(0, 50, d, d);
ellipse(100, 50, d, d);
ellipse(50, 0, d, d);
ellipse(50, 100, d, d);
d += speed * direction;
if ((d > width) || (d < width/10)) {
direction = -direction;
}
}