/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://fgcs.sketchpad.cc/sp/pad/view/ro.nahPwMkSNPf/rev.445
*
* authors:
* Lachlan Dalaigh Wilger
* Doña Roberts
* Tessa White
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// Global variables
float radius = 50.0;int X, Y;int nX, nY;int delay = 16;
// Setup the Processing Canvas
void setup(){
size( 200, 200 );
strokeWeight( 10 );
frameRate( 15 );
X = width / 2;
Y = height / 2;
nX = X;
nY = Y;
}
// Main draw loop
void draw(){
radius = radius + sin( frameCount / 4 );
if (mousePressed)
nY = 0;
else
nY = min(height,nY + 10);
// Track circle to new destination
X+=(nX-X)/delay;
Y+=(nY-Y)/delay;
// Fill canvas grey
background( 255, 255, 255 );
fill( 120, 120, 0 );
// Set stroke-color white
stroke( 155, 155, 0 );
float tilt = sin(frameCount/10);
// set inside color based on tilt
if (tilt>0)
fill( 110, 100, 0 );
else
fill( 100, 110, 0 );
if (Y >= height-1) {
Y = height;
tilt = 0;
}
// Draw coin
ellipse( X, Y, radius, radius*tilt );
}