/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.Lf22j-MeWaO/rev.1569
*
* authors:
* carson
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
angle=0.0;
angleDirection=1;
speed=.005;
var sun=200;
void setup()
{
size(500, 500);
}
void draw()
{
background(100, 100, 255);
fill(0);
ellipse(250, 290, 75, 130);
ellipse(250, 180, 100, 100);
fill(255,0,0);
ellipse(250, 200, 50, 25);
fill(255);
ellipse(225, 165, 40, 40);
ellipse(275, 165, 40, 40);
fill(0);
ellipse(225, 165, 20, 20);
ellipse(275, 165, 20, 20);
//sun
fill(255 ,255, 0);
ellipse(sun, 75, 100 ,100);
sun = sun +1;
if (sun > width){
sun =0 ;
}
fill(255);
ellipse(200, 75, 150, 75);
//ground
fill(0, 175, 0);
rect(1, 390, 500, 105);
drawarm(230,250,-1,1.5);
drawarm(270,250,1,1.5);
drawarm(230,290,-1,1.2);
drawarm(270,290,1,1.2);
drawstaticarm(230,330,-1,1);
drawstaticarm(270,330,1,1);
// drawarm(230,250,-1,1.5);
//drawarm(270,250,1,1.5);
angle+=speed*angleDirection;
if( (angle>QUARTER_PI/2) || (angle<0))
{ angleDirection *=-1;}
}
function drawarm(x,y,flip,len)
{
pushMatrix();
translate(x,y);
rotate(angle*flip);
strokeWeight(12);
line(0,0,40*flip*len,0);
translate(40*flip*len,0);
rotate(angle*flip*2);
strokeWeight(6);
line(0,0,30*flip*len,0);
translate(30*flip*len,0);
rotate(angle*2.5*flip);
strokeWeight(3);
line(0,0,20*flip*len,0);
popMatrix();
}
function drawstaticarm(x,y,flip,len)
{
pushMatrix();
translate(x,y);
rotate(QUARTER_PI/2*flip);
strokeWeight(12);
line(0,0,40*flip*len,0);
translate(40*flip*len,0);
rotate(QUARTER_PI/2*flip*2);
strokeWeight(6);
line(0,0,30*flip*len,0);
translate(30*flip*len,0);
rotate(QUARTER_PI/2*2.5*flip);
strokeWeight(3);
line(0,0,20*flip*len,0);
popMatrix();
}