> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://tafe.sketchpad.cc/sp/pad/view/ro.SV9sLmGXIXf/rev.15
 * 
 * authors: 
 *   Jesus Cuauhtemoc
 *   Andew Chee

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



int x=-50;
int y=-50;
int speedY=3;
int counterX=4;
float b=30;
float amt=0.1;
float circleamt=0.1;
int bg=0;
float counterZ=0.003;
int circle=0;
int sunswitch=1;
int sunswitchcount=1;

void setup(){
  size(400,400);
  
}


void draw() {
  color bg1 = color(0,189,255);
  color bg2 = color(4, 6, 88);
  color bg = lerpColor(bg1,bg2,amt);
  background(bg);
  
  ellipseMode(CORNER);
  fill(#000000);
  ellipse(x,b,50,10);
  ellipseMode(CENTER);
  color circle1 = color(247,218,97);
  color circle2 = color(255,255,255);
  color circle = lerpColor(circle1,circle2,circleamt);
  fill(circle);
  ellipse(width/2,y,50,50);
  rectMode(CENTER);
  fill(#00B91D);
  rect(width/2,350,400,100);
  print(sunswitch);
  if(mousePressed){
    x=x+counterX;
    y=y+speedY;
    if(y>350){speedY=-speedY; sunswitch=sunswitch+sunswitchcount;}
    if(y<-50)  {speedY=-speedY; sunswitch=sunswitch+sunswitchcount;}
    if(x>400) {x=-50; b=random(0,height);}
    if(sunswitch>1) {circleamt=0.9;sunswitchcount=-sunswitchcount;}
    if(sunswitch<1) {circleamt=0.1;sunswitchcount=-sunswitchcount;}
    amt=amt+counterZ;
    if(amt>0.88) {counterZ=-counterZ;}
    if(amt<0.101) {counterZ=-counterZ;}
}
}