Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
void setup(){
size(400,400);
    strokeWeight(1);
}

void draw(){
  noStroke();
//back sky
  fill(77,81,137);
  rect(0,0,400,400);
  fill(0,0,25,25);
  rect(0,0,400,25);
  rect(0,0,400,50);
  rect(0,0,400,75);
  rect(0,0,400,100);
  rect(0,0,400,125);
  rect(0,0,400,150);
  //meteor glow
  fill(255,0,0,(mouseX/400f)*165-40);
  rect(0,0,400,400);
  fill(255,0,0,(mouseX/400f)*20f);
  rect(0,0,400,80);
  rect(0,0,400,60);
  rect(0,0,400,40);
  rect(0,0,400,20);
  
  //background
  fill(255,0,0,15);
  rect(0,190+(mouseY/90f),400,400);
  rect(0,200+(mouseY/90f),400,400);
  fill(137+(mouseX/400f)*80,122,112);
  rect(0,210+(mouseY/60f),400,400);
  fill((137+(mouseX/400f)*80)*(1-(mouseX/400f*0.5f)),122*(1-(mouseX/400f*0.5f)),112*(1-(mouseX/400f*0.5f)));
  triangle(0-(mouseX/40f),210+(mouseY/60f),30-(mouseX/40f),190+(mouseY/60f),50-(mouseX/40f),210+(mouseY/60f));
  triangle(20-(mouseX/40f),210+(mouseY/60f),80-(mouseX/40f),180+(mouseY/60f),140-(mouseX/40f),210+(mouseY/60f));
  fill(0,0,0,mouseX/400f*100); //mountain shadow
  triangle(0-(mouseX/40f),210+(mouseY/60f),140-(mouseX/40f),210+(mouseY/60f),70-(mouseX/5f),210+(mouseY/35f)+(mouseX/30f));
  
  fill(15,0,0,20);
  rect(0,300+(mouseY/60f),400,400);
  rect(0,280+(mouseY/60f),400,400);  
  rect(0,360+(mouseY/60f),400,400);
  rect(0,240+(mouseY/60f),400,400);
  rect(0,220+(mouseY/60f),400,400);

  //near mountains
    fill((119+(mouseX/400f)*40)*(1-(mouseX/400f*0.5f)),93*(1-(mouseX/400f*0.5f)),76*(1-(mouseX/400f*0.5f)));
  triangle(170-(mouseX/15f),290+(mouseY/12f),289-(mouseX/15f),130+(mouseY/12f),370-(mouseX/15f),290+(mouseY/12f));
   triangle(220-(mouseX/15f),290+(mouseY/12f),400-(mouseX/15f),99+(mouseY/12f),600-(mouseX/15f),290+(mouseY/12f));

  
  //foreground
  fill(193+(mouseX/400f)*10,151-(mouseX/400f)*40,124-(mouseX/400f)*40);
  rect(-20,260+(mouseY/8f),420,400);
  fill(15,0,0,10);
  rect(-20,380+(mouseY/8f),420,400);
  rect(-20,370+(mouseY/8f),420,400);
  rect(-20,360+(mouseY/8f),420,400);
  rect(-20,350+(mouseY/8f),420,400);
  rect(-20,340+(mouseY/8f),420,400);
  rect(-20,330+(mouseY/8f),420,400);
  rect(-20,320+(mouseY/8f),420,400);
  rect(-20,310+(mouseY/8f),420,400);
  
  //near mountain shadow
  fill(0,0,0,mouseX/400f*100);
  triangle(190-(mouseX/15f),260+(mouseY/8f),600-(mouseX/15f),260+(mouseY/8f),800-(mouseX/2f),260+(mouseY/7f)+(mouseX/3f));
  
  //meteor!
   fill(255);
  triangle(30+(mouseX/400f)*150,30+(mouseX/400f)*170,30+(mouseX/400f)*170,30+(mouseX/400f)*150,30+(mouseX/400f)*30,30+(mouseX/400f)*30);
  fill(256,256*(1-(mouseX/400f)),256*(1-(mouseX/400f)));
  ellipse(30+(mouseX/400f)*170,30+(mouseX/400f)*170,(mouseX/400f)*40,(mouseX/400f)*40);

  
  //White Flash
  fill(255,((mouseX-300)/100f)*128);
  rect(0,0,400,400);
  
  //Dino Shadow
  fill(0,(mouseX/400f)*256-45);
  triangle(340-(mouseX/15f),330+(mouseY/8f),315-(mouseX/15f),330+(mouseY/8f),530-(mouseX/2f),500+(mouseY/8f));
  triangle(295-(mouseX/15f),335+(mouseY/8f),270-(mouseX/15f),337+(mouseY/8f),505-(mouseX/2f),500+(mouseY/8f));
  strokeWeight(1f);
 
  //back leg
  fill(168*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  130*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  84*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
    stroke(168*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  130*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  84*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  triangle(327-(mouseX/15f),297+(mouseY/8f),320-(mouseX/15f),312+(mouseY/8f),296-(mouseX/15f),301+(mouseY/8f));
   triangle(340-(mouseX/15f),330+(mouseY/8f),322-(mouseX/15f),308+(mouseY/8f),296-(mouseX/15f),301+(mouseY/8f)); 
   triangle(340-(mouseX/15f),330+(mouseY/8f),315-(mouseX/15f),330+(mouseY/8f),330-(mouseX/15f),325+(mouseY/8f));
  
  
  
  //front leg
  fill(226*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  154*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  65*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  stroke(226*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  154*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  65*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  
  ellipse(320-(mouseX/15f),280+(mouseY/8f),40,40); //thigh
  triangle(280-(mouseX/15f),300+(mouseY/8f),300-(mouseX/15f),270+(mouseY/8f),330-(mouseX/15f),297+(mouseY/8f));
  triangle(280-(mouseX/15f),298+(mouseY/8f),285-(mouseX/15f),315+(mouseY/8f),330-(mouseX/15f),310+(mouseY/8f));
  triangle(295-(mouseX/15f),335+(mouseY/8f),310-(mouseX/15f),310+(mouseY/8f),330-(mouseX/15f),310+(mouseY/8f));
  triangle(295-(mouseX/15f),335+(mouseY/8f),270-(mouseX/15f),337+(mouseY/8f),305-(mouseX/15f),320+(mouseY/8f));
  
  //rotating teeth (owch)
  fill(255*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  noStroke();
  triangle(270-(55*cos(mouseX/700f*HALF_PI))-(mouseX/15f),225-(55*sin(mouseX/700f*HALF_PI))+(mouseY/8f),270-(50*cos(mouseX/700f*HALF_PI)+10*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(-10*cos( mouseX/700f*HALF_PI)+50*sin( mouseX/700f*HALF_PI))+(mouseY/8f),270-(45*cos(mouseX/700f*HALF_PI))-(mouseX/15f),225-(45*sin(mouseX/700f*HALF_PI))+(mouseY/8f));
  triangle(270-(45*cos(mouseX/700f*HALF_PI))-(mouseX/15f),225-(45*sin(mouseX/700f*HALF_PI))+(mouseY/8f),270-(40*cos(mouseX/700f*HALF_PI)+10*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(-10*cos( mouseX/700f*HALF_PI)+40*sin( mouseX/700f*HALF_PI))+(mouseY/8f),270-(35*cos(mouseX/700f*HALF_PI))-(mouseX/15f),225-(35*sin(mouseX/700f*HALF_PI))+(mouseY/8f));
  triangle(270-(35*cos(mouseX/700f*HALF_PI))-(mouseX/15f),225-(35*sin(mouseX/700f*HALF_PI))+(mouseY/8f),270-(30*cos(mouseX/700f*HALF_PI)+10*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(-10*cos( mouseX/700f*HALF_PI)+30*sin( mouseX/700f*HALF_PI))+(mouseY/8f),270-(25*cos(mouseX/700f*HALF_PI))-(mouseX/15f),225-(25*sin(mouseX/700f*HALF_PI))+(mouseY/8f));
  triangle(270-(25*cos(mouseX/700f*HALF_PI))-(mouseX/15f),225-(25*sin(mouseX/700f*HALF_PI))+(mouseY/8f),270-(20*cos(mouseX/700f*HALF_PI)+10*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(-10*cos( mouseX/700f*HALF_PI)+20*sin( mouseX/700f*HALF_PI))+(mouseY/8f),270-(15*cos(mouseX/700f*HALF_PI))-(mouseX/15f),225-(15*sin(mouseX/700f*HALF_PI))+(mouseY/8f));
  
  
  
 //chin
 fill(168*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  130*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  84*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
    stroke(168*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  130*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  84*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  
  rect(230-(mouseX/15f),225+(mouseY/8f),40,12);
  triangle(230-(mouseX/15f),225+(mouseY/8f),224-(mouseX/15f),225+(mouseY/8f),230-(mouseX/15f),236+(mouseY/8f));
  fill(255*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  noStroke();
  triangle(225-(mouseX/15f),225+(mouseY/8f),230-(mouseX/15f),215+(mouseY/8f),235-(mouseX/15f),225+(mouseY/8f));
  triangle(235-(mouseX/15f),225+(mouseY/8f),240-(mouseX/15f),215+(mouseY/8f),245-(mouseX/15f),225+(mouseY/8f));
  triangle(245-(mouseX/15f),225+(mouseY/8f),250-(mouseX/15f),215+(mouseY/8f),255-(mouseX/15f),225+(mouseY/8f));
  
   //body
  
  fill(226*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  154*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  65*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  stroke(226*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  154*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  65*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  
  
  triangle(270-(mouseX/15f),190+(mouseY/8f),270-(mouseX/15f),236+(mouseY/8f),300-(mouseX/15f),221+(mouseY/8f)); //upper neck
  triangle(285-(mouseX/15f),265+(mouseY/8f),270-(mouseX/15f),236+(mouseY/8f),300-(mouseX/15f),221+(mouseY/8f)); //chest
  triangle(285-(mouseX/15f),265+(mouseY/8f),330-(mouseX/15f),250+(mouseY/8f),300-(mouseX/15f),221+(mouseY/8f)); //belly
  triangle(285-(mouseX/15f),265+(mouseY/8f),330-(mouseX/15f),250+(mouseY/8f),338-(mouseX/15f),290+(mouseY/8f)); //booty
  triangle(400-(mouseX/15f),265+(mouseY/8f),328-(mouseX/15f),250+(mouseY/8f),334-(mouseX/15f),290+(mouseY/8f)); //tail
  
  triangle(270-(mouseX/15f),230+(mouseY/8f),265-(mouseX/15f),265+(mouseY/8f),280-(mouseX/15f),245+(mouseY/8f)); //arm
  
  
  //rotating head (WHAT A BEAST. If only I could use functions...)
  fill(226*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  154*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  65*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  stroke(226*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  154*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)),
  65*(1-((mouseX*mouseX)/ 160000f)-(mouseX/400f/20f)));
  
  triangle(270-(55*cos(mouseX/700f*HALF_PI)-35*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(35*cos( mouseX/700f*HALF_PI)+55*sin( mouseX/700f*HALF_PI))+(mouseY/8f),270-(mouseX/15f),225+(mouseY/8f),270-(-35*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(35*cos( mouseX/700f*HALF_PI))+(mouseY/8f)); //headA
  triangle(270-(55*cos(mouseX/700f*HALF_PI)-35*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(35*cos( mouseX/700f*HALF_PI)+55*sin( mouseX/700f*HALF_PI))+(mouseY/8f),270-(mouseX/15f),225+(mouseY/8f),270-(55*cos( mouseX/700f*HALF_PI))-(mouseX/15f),225-(55*sin( mouseX/700f*HALF_PI))+(mouseY/8f)); //headB
  ellipse(270-(53*cos(mouseX/700f*HALF_PI)-28*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(28*cos( mouseX/700f*HALF_PI)+53*sin( mouseX/700f*HALF_PI))+(mouseY/8f),15,15); //nose
  triangle(270-(60*cos(mouseX/700f*HALF_PI)-25*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(25*cos( mouseX/700f*HALF_PI)+60*sin( mouseX/700f*HALF_PI))+(mouseY/8f),270-(55*cos(mouseX/700f*HALF_PI)-25*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(25*cos( mouseX/700f*HALF_PI)+55*sin( mouseX/700f*HALF_PI))+(mouseY/8f),270-(55*cos( mouseX/700f*HALF_PI))-(mouseX/15f),225-(55*sin( mouseX/700f*HALF_PI))+(mouseY/8f)); //upper lip
  triangle(270-(-35*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(35*cos( mouseX/700f*HALF_PI))+(mouseY/8f),270-(mouseX/15f),225+(mouseY/8f),270-(-20*cos(mouseX/700f*HALF_PI)-20*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(20*cos( mouseX/700f*HALF_PI)-20*sin( mouseX/700f*HALF_PI))+(mouseY/8f)); //cranium
  
  
  stroke(0,0,0); //turn on stroke for eye
  strokeWeight(2);
  fill(255);
  ellipse(270-(23*cos(mouseX/700f*HALF_PI)-35*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(35*cos( mouseX/700f*HALF_PI)+23*sin( mouseX/700f*HALF_PI))+(mouseY/8f),mouseX/400f*20f+5f,mouseX/400f*20f+5f); //eye
  noStroke();
  fill(0);
  ellipse(270-(23*cos(mouseX/700f*HALF_PI)-35*sin( mouseX/700f*HALF_PI))-(mouseX/15f),225-(35*cos( mouseX/700f*HALF_PI)+23*sin( mouseX/700f*HALF_PI))+(mouseY/8f),10,10); //pupil
  
 
  noStroke();
  
    //RIP Dino Flash
  fill(255,((mouseX-350)/50f)*256+5);
  rect(0,0,400,400);
  
  //Signature
  
  noFill();
  stroke(128,128,128,34);
  strokeWeight(2);
  arc(20,360,17,22,QUARTER_PI,TWO_PI-QUARTER_PI);
  arc(33,358,15,17,0,PI-QUARTER_PI);
  arc(33,358,15,19,PI+QUARTER_PI,TWO_PI);
  ellipse(22,360,10,10);
  ellipse(32,360,7,7);
  line(20,370,35,367);
  line(20,370,20,383);
  line(35,367,35,383);
  line(20,383,35,383);
  line(27,370,27,383);
  
  arc(45,369,15,13,PI+QUARTER_PI,TWO_PI*0.75f); //open mouth
  arc(43,377,17,14,0,PI-QUARTER_PI);
  arc(45,377,12,25,TWO_PI*0.75,TWO_PI);
  
  line(22,344,27,333);//fins
  line(32,344,27,333);
  line(49,362,52,358);
  line(55,372,62,371);
  line(52,358,62,371);
  line(12,373,3,373);
  line(15,377,8,384);
  line(3,373,8,384);
  
  arc(33,373,45,37,0,PI-QUARTER_PI*0.75f); //body
  arc(18,375,25,65,PI+QUARTER_PI*0.55f,TWO_PI*0.75f);
  arc(15,360,75,40,TWO_PI*0.85f,TWO_PI-QUARTER_PI*0.5f);
  noStroke();
}