Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/*
Title:Magician's Bunny

By: Benny Chung

Description: 
The Bunny follows the mouse up and down, in order to rise from within the Top Hat.
The vertical motion of the mouse also controls the brightness of the spot-light on the bunny.
The left and right motion of the mouse controls the eye of the bunny so it can look left and right
it also controls the background carrots (+ropes) in order to sway left and right.

The movement of both the X and Y axis of the mouse directly control the movement of the Carrot Cursor
*/


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


void draw(){
 //Background//
 noStroke();
 colorMode(RGB);
  background(177,99,253);
  fill(135,59,1);
  rect(0,320,400,80);
  
  //Carrots//
   //Rope//
   strokeWeight(5);
   stroke(135,86,56);
   line(40,0,20+(mouseX*0.1),80);
   line(360,0,340+(mouseX*0.1),120);
   //Carrots//
   strokeWeight(1);
   noStroke();
   fill(229,83,0);
   triangle(10+(mouseX*0.05),80,60+(mouseX*0.05),80,20+(mouseX*0.1),140);
   triangle(320+(mouseX*0.05),120,380+(mouseX*0.05),120,340+(mouseX*0.1),180);
  
 //Inner Hat//
 fill(30);
 ellipse(200,160,280,120);
 fill(0);
 ellipse(200,160,200,80);
 
 //Bunny//
   //Body//
   fill(200);
   ellipse(200,mouseY+140,140,200);
   fill(241,144,244);
   ellipse(200,mouseY+130,80,100);
   //Ears//
   fill(200);
   ellipse(140,mouseY-80,60,160);
   ellipse(260,mouseY-80,60,160);
   fill(241,144,244);
   ellipse(140,mouseY-70,40,120);
   ellipse(260,mouseY-70,40,120);
   //Head//
   fill(200);
   ellipse(200,mouseY,160,140);
     //Facial Features//
       //Eyes//
         //Black//
         fill(0);
         ellipse(170,mouseY-20,20,20);
         ellipse(240,mouseY-20,20,20);
         //White//
         fill(255);
         ellipse(mouseX/40+165,mouseY-25,5,5);
         ellipse(mouseX/40+235,mouseY-25,5,5);
       //Nose//
       fill(241,144,244);
       triangle(200,mouseY+20,190,mouseY+5,210,mouseY+5);
 
 //Extra-Table//
 fill(135,59,1);
 ellipse(200,360,200,140);
 
 //Outter Hat//
 noStroke();
 fill(40);
 ellipse(200,360,200,80);
 rect(100,220,200,140);
 fill(255,0,0);
 ellipse(200,295,200,140);
 rect(100,270,200,20);
 fill(40);
 ellipse(200,265,200,140);
 rect(100,200,200,20);
 noFill();
 strokeWeight(40);
 stroke(30);
 arc(200,160,240,110,0,PI);
 
 //Carrot Cursor//
   //Leaves//
     noStroke();
     fill(0,130,0);
     triangle(mouseX+24,mouseY-32,mouseX+40,mouseY-8,mouseX+24,mouseY-48);
     triangle(mouseX+24,mouseY-32,mouseX+40,mouseY-8,mouseX+56,mouseY-8);
     triangle(mouseX+24,mouseY-32,mouseX+40,mouseY-8,mouseX+48,mouseY-32);
   //Root//
       //Main Root//
       fill(255,165,0);
       triangle(mouseX+24,mouseY-32,mouseX+40,mouseY-8,mouseX,mouseY);
       //Lines//
       strokeWeight(2);
       stroke(196,127,0);
       line(mouseX+16,mouseY-4,mouseX+12,mouseY-10);
       line(mouseX+25,mouseY-6,mouseX+18,mouseY-16);
       
 
 //Spot-Light//
 noStroke();
 colorMode(HSB);
 fill(50,255,255,(mouseY-300)*-0.25);
 triangle(0,400,400,400,200,-1000);
 

 
}