Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
//Choice

void setup(){
size(400,400);// Set the paper size into 400*400
smooth();     //smooth shapes
}

void draw(){
  colorMode(HSB);    
                  //Change color mode into HSB, which can controll
                  //brightness and hue easily.
  background(mouseX/2.8,55,mouseX/2+40);
  
  colorMode(RGB);   //Switch color mode back to RGB.
  
                    //Fire in the backgrond, moves by the mouse
  fill(255,85,0);
  triangle(180,mouseY/20+200,60,mouseY/20+300,120,mouseY/20+350);
  triangle(150,mouseY/20+90,60,mouseY/20+120,120,mouseY/20+300);
  triangle(120,mouseY/20+320,180,mouseY/20+160,120,mouseY/20+200);
  triangle(80,mouseY/20+50,20,mouseY/20+200,100,mouseY/20+200);
  triangle(20,mouseY/20+70,20,mouseY/20+200,100,mouseY/20+200);
  triangle(0,mouseY/20+90,0,mouseY/20+200,100,mouseY/20+200);
  
  fill(255,210,10);
  triangle(150,mouseY/10+200,60,mouseY/10+210,100,mouseY/10+370);
  triangle(130,mouseY/10+110,60,mouseY/10+140,120,mouseY/10+320);
  triangle(100,mouseY/10+340,180,mouseY/10+180,120,mouseY/10+220);
  triangle(90,mouseY/10+70,20,mouseY/10+220,100,mouseY/10+220);
  triangle(40,mouseY/10+90,20,mouseY/10+220,100,mouseY/10+220);
  triangle(0,mouseY/10+100,0,mouseY/10+220,100,mouseY/10+220);
  
  
         //Light in the background, change size according to mousseY
  
  fill(255,238,193);
  ellipse(350,250,mouseY/15+270,mouseY/15+270);
  fill(255,255,255);
  ellipse(350,250,mouseY/10+240,mouseY/10+240);
  fill(255,238,193);
  ellipse(350,250,mouseY/20+180,mouseY/20+180);
               
                        
                        //Devil       
  rectMode(CORNER);           //Body
  fill(147,20,40);
  rect(0,180,120,300);
   
  fill(116,21,23);
  triangle(60,120,30,190,100,190);
    
  fill(147,20,40);            //chin
  triangle(45,150,120,140,100,190);
  ellipseMode(CENTER);      
  
  fill(90,30,45);             //horn-1
  triangle(100,100,120,120,140,100);
  triangle(130,70,120,120,140,100);

  fill(147,20,40);             //head
  ellipse(80,120,90,90);
  
  fill(90,30,45); 
  triangle(80,100,60,110,40,90);//horn-2
  triangle(60,60,60,110,40,90);
  
  
  
  
                        //Angle
  rectMode(CORNER);           //Body
  fill(230,205,180);
  rect(280,180,400,300);
   
  fill(155,133,105);
  triangle(360,120,380,190,300,190);                      
                        
  fill(230,205,180);           //Head
  triangle(285,150,355,150,300,190);
  ellipseMode(CENTER);       
  ellipse(320,120,90,90);
  
  fill(250,240,120);
  triangle(280,60,280,80,340,80);
  triangle(380,60,380,80,320,80);
  triangle(280,60,280,70,340,50);
  triangle(380,60,380,70,320,50);
  
  
    
           //Matt:  change transparency when mouse move left and right

  fill(0,0,0,mouseX/2);
  rectMode(CORNER);
  rect(0,0,200,400);
  
  fill(0,0,0,mouseX/200+80);
  rectMode(CORNER);
  rect(200,0,400,400);
    
 
  colorMode(RGB);    //arm
  fill(211,190,166);  
  noStroke();//hand
  rectMode(CENTER);
  rect(mouseX,mouseY,56,50);
  triangle(mouseX+10,mouseY-30,mouseX+20,mouseY+30,mouseX+35,mouseY-20);
  
  rectMode(CENTER);
 fill(160,139,115);
  rect(mouseX,mouseY+50,50,100);
  
  fill(234,206,187);
 triangle(mouseX-25,mouseY,mouseX+30,mouseY-5,mouseX+25,mouseY+40);
 
  fill(211,190,166);
  rect(pmouseX+5,mouseY+70,50,80);
  rect(pmouseX+2,pmouseY+80,50,100);
  
 
 
  noStroke();      //Thumb
  triangle(mouseX-30,mouseY+20,mouseX-60,mouseY,mouseX-20,mouseY);
  triangle(mouseX-50,mouseY-30,mouseX-60,mouseY,mouseX-30,mouseY);
  triangle(mouseX-50,mouseY-30,mouseX-60,mouseY,mouseX-70,mouseY-40);
  
  fill(160,139,115);//shadow of thumb
  triangle(mouseX-60,mouseY,mouseX-20,mouseY+30,mouseX-70,mouseY-40);
  
                    //fingers: including shadow part and
                    //bright part of finger
  fill(183,149,126);
  triangle(mouseX+35,mouseY-40,mouseX+30,mouseY-10,mouseX+25,mouseY-60);
  fill(211,190,166);
  triangle(mouseX+33,mouseY-10,mouseX+20,mouseY-15,mouseX+28,mouseY-40);
  triangle(mouseX+30,mouseY-25,mouseX+15,mouseY-60,mouseX+25,mouseY-60);
   
  fill(183,149,126);
  triangle(mouseX+20,mouseY-50,mouseX+20,mouseY-15,mouseX+5,mouseY-80);
  fill(211,190,166);
  triangle(mouseX+25,mouseY-15,mouseX+10,mouseY-20,mouseX+10,mouseY-50);
  triangle(mouseX+18,mouseY-30,mouseX-5,mouseY-60,mouseX+5,mouseY-80);

  fill(183,149,126);
  triangle(mouseX,mouseY-55,mouseX+5,mouseY-22,mouseX-20,mouseY-90);
  fill(211,190,166);
  triangle(mouseX+15,mouseY-20,mouseX-10,mouseY-25,mouseX-10,mouseY-60);
  triangle(mouseX,mouseY-40,mouseX-25,mouseY-60,mouseX-20,mouseY-90);
  
  fill(183,149,126);
  triangle(mouseX-15,mouseY-60,mouseX-5,mouseY-25,mouseX-45,mouseY-90);
  fill(211,190,166);
  triangle(mouseX-26,mouseY-25,mouseX-5,mouseY-25,mouseX-25,mouseY-60);
  triangle(mouseX-50,mouseY-60,mouseX-10,mouseY-35,mouseX-45,mouseY-90);
  
}

void mousePressed(){  
        //show the lines when mouse is pressed, also shows"good choice"
   
  stroke(0);
  strokeWeight(2);
  println("Good choice!");
}