Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
//The beginning set up for this program
void setup() {
  //window size 400,400 pixels
  size(400, 400);
//Make the image refresh 30 frames per second
  frameRate(30);
//hide mouse cursor
  noCursor();
}

//The repeating cycle of the images
void draw() {
  
//Set up the background colour
  background(114+mouseX/40,187+mouseY/80,90+mouseX/50);
  
//background decorate
  strokeWeight(30);
  rectMode(CENTER);
  
  //set the colour that will change depend on coordinate of cursor
  fill(90+mouseX/2,130+mouseY/2,162+mouseX/8,60);
  rect(80,120,80,80);
  fill(130+mouseX/2,170+mouseY/2,90+mouseX/8,60);
  rect(50,290,60,60);
  fill(40+mouseX/2,110+mouseY/2,190+mouseX/8,60);
  rect(250,90,110,110);
  fill(80+mouseX/2,150+mouseY/2,230+mouseX/8,60);
  rect(340,240,70,70);
  fill(90+mouseX/2,215+mouseY/2,40+mouseX/8,60);
  rect(250,300,90,90);
  fill(210+mouseX/2,180+mouseY/2,235+mouseX/8,60);
  rect(140,230,50,50);
  
  
//Change back to defeault
  strokeWeight(1);
  
  
//The character image parts
  noStroke();//no stroke for the shape
  
  //middle part of underhead's hair 
  fill(250,215,152);//set the colour to dark yellow
  triangle(-10+mouseX,60+mouseY,10+mouseX,50+mouseY,5+pmouseX,80+pmouseY);
  triangle(-20+mouseX,55+mouseY,5+mouseX,55+mouseY,-10+pmouseX,85+pmouseY);
  triangle(0+mouseX,50+mouseY,35+mouseX,60+mouseY,15+pmouseX,80+pmouseY);
  triangle(-20+mouseX,50+mouseY,-5+mouseX,60+mouseY,-22.5+pmouseX,80+pmouseY);
  
  //right part of underhead's hair 
  triangle(20+mouseX,50+mouseY,45+mouseX,55+mouseY,30+pmouseX,77+pmouseY);
  triangle(35+mouseX,45+mouseY,52+mouseX,50+mouseY,42+pmouseX,72+pmouseY);
  triangle(20+mouseX,52+mouseY,50+mouseX,15+mouseY,70+pmouseX,65+pmouseY);
  triangle(0+mouseX,10+mouseY,58+mouseX,10+mouseY,55+pmouseX,50+pmouseY);
  
  //left part of underhead's hair 
  fill(254,243,190);//set the colour to light yellow
  triangle(-35+mouseX,30+mouseY,-30+mouseX,55+mouseY,-55+pmouseX,70+pmouseY);
  fill(250,215,152);//set the colour to dark yellow
  quad(-35+mouseX,50+mouseY,-30+mouseX,30+mouseY,-15+mouseX,60+mouseY,-30+pmouseX,80+pmouseY);
  quad(-45+pmouseX,50+pmouseY,-30+mouseX,50+mouseY,-30+pmouseX,80+pmouseY,-40+pmouseX,70+pmouseY);
  quad(-42+mouseX,5+mouseY,-20+mouseX,20+mouseY,-30+mouseX,55+mouseY,-45+pmouseX,50+pmouseY);
  
  //Head
  fill(254,230,217);//set the colour to skin colour
  triangle(-35+mouseX,20+mouseY,-30+mouseX,-10+mouseY,40+mouseX,20+mouseY);
  quad(-35+mouseX,20+mouseY,40+mouseX,10+mouseY,35+mouseX,50+mouseY,-25+mouseX,50+mouseY);
  quad(-30+mouseX,50+mouseY,-25+mouseX,30+mouseY,-17.5+mouseX,62.5+mouseY,-30+mouseX,56+mouseY);
  quad(-25+mouseX,40+mouseY,10+mouseX,40+mouseY,0+mouseX,65+mouseY,-17.5+mouseX,62.5+mouseY);
  quad(0+mouseX,40+mouseY,40+mouseX,40+mouseY,30+mouseX,60+mouseY,0+mouseX,65+mouseY);
  
  //left part of hair
  fill(252,254,255);//set the colour to yellow high light
  triangle(-60+mouseX,-10+pmouseY,-50+mouseX,-10+mouseY,-35+mouseX,0+mouseY);
  triangle(-50+mouseX,-10+mouseY,-35+mouseX,-17+mouseY,-35+mouseX,5+mouseY);
  triangle(-58+pmouseX,30+pmouseY,-55+mouseX,11+mouseY,-35+mouseX,2.5+mouseY);
  triangle(-55+mouseX,11+mouseY,-40+mouseX,-10+mouseY,-35+mouseX,4+mouseY);
  fill(254,243,190);//set the colour to light yellow
  quad(-50+mouseX,30+mouseY,-45+mouseX,0+mouseY,-35+mouseX,10+mouseY,-48+pmouseX,50+pmouseY);
  triangle(-42.5+pmouseX,52.5+pmouseY,-35+pmouseX,50+pmouseY,-32+pmouseX,63+pmouseY);
  quad(-46+pmouseX,30+mouseY,-30+pmouseX,19+mouseY,-35+pmouseX,51+pmouseY,-42.5+pmouseX,52.5+pmouseY);
  quad(-40+mouseX,5+mouseY,-25+mouseX,9+mouseY,-30+pmouseX,20+mouseY,-46+pmouseX,30+mouseY);
  fill(252,254,255);//set the colour to yellow high light
  quad(-35+mouseX,-17+mouseY,-20+mouseX,5+mouseY,-25+mouseX,10+mouseY,-40+mouseX,5+mouseY);
  
  //top part of hair
  fill(254,243,190);//set the colour to light yellow
  quad(-40+mouseX,-14+mouseY,-18+mouseX,-24+mouseY,25+mouseX,10+mouseY,-30+mouseX,0+mouseY);
  fill(250,215,152);//set the colour to dark yellow
  quad(-40+mouseX,-14+mouseY,-20+mouseX,-25+mouseY,25+mouseX,10+mouseY,-20+mouseX,-10+mouseY);
  triangle(-20+mouseX,-25+mouseY,15+mouseX,-30+mouseY,24+mouseX,11+mouseY);
  quad(15+mouseX,-30+mouseY,35+mouseX,-25+mouseY,40+mouseX,20+mouseY,0+mouseX,5+mouseY);
  triangle(35+mouseX,-25+mouseY,50+mouseX,-15+mouseY,37+mouseX,20+mouseY);
  quad(50+mouseX,-15+mouseY,58+mouseX,10+mouseY,45+mouseX,30+mouseY,35+mouseX,8+mouseY);
  fill(252,254,255);//set the colour to yellow high light
  triangle(35+mouseX,5+mouseY,45+mouseX,-2+mouseY,45+mouseX,5+mouseY);
  quad(45+mouseX,-2+mouseY,50+mouseX,-15+mouseY,56+mouseX,0+mouseY,45+mouseX,5+mouseY);
  
  //head set part1
  fill(243,224,252);//set the colour to medium pink 
  quad(45+mouseX,25+mouseY,50+mouseX,25+mouseY,50+mouseX,32+mouseY,40+mouseX,35+mouseY);
  quad(40+mouseX,35+mouseY,50+mouseX,30+mouseY,50+mouseX,40+mouseY,40+mouseX,45+mouseY);
  
  //left part of hair
  fill(254,243,190);//set the colour to light yellow
  triangle(29+pmouseX,50+pmouseY,40+pmouseX,50+pmouseY,24+pmouseX,68+pmouseY);
  quad(30+pmouseX,30+mouseY,45+pmouseX,30+mouseY,40+pmouseX,50+pmouseY,30+pmouseX,50+pmouseY);
  quad(25+mouseX,10+mouseY,40+mouseX,10+mouseY,45+pmouseX,30+mouseY,30+pmouseX,30+mouseY);
  fill(250,235,182);//set the colour to medium yellow
  quad(25+mouseX,10+mouseY,40+mouseX,10+mouseY,45+pmouseX,30+mouseY,29+pmouseX,20+mouseY);
  
  //front part of hair
  fill(254,243,190);//set the colour to light yellow
  quad(-30+pmouseX,0+mouseY,-7+mouseX,-15+mouseY,0+mouseX,-5+mouseY,-10+mouseX,15+mouseY);
  quad(-10+mouseX,15+mouseY,0+mouseX,-5+mouseY,15+mouseX,0+mouseY,10+mouseX,20+mouseY);
  quad(10+mouseX,20+mouseY,15+mouseX,0+mouseY,45+mouseX,10+mouseY,40+mouseX,18+mouseY);
  
  //head set part2
  fill(246,228,255);//set the colour to light pink
  quad(0+mouseX,-18+mouseY,5+mouseX,-23+mouseY,20+mouseX,-18+mouseY,16+mouseX,-10+mouseY);
  quad(16+mouseX,-10+mouseY,20+mouseX,-18+mouseY,35+mouseX,-5+mouseY,30+mouseX,0+mouseY);
  quad(30+mouseX,0+mouseY,35+mouseX,-5+mouseY,45+mouseX,10+mouseY,40+mouseX,15+mouseY);
  quad(40+mouseX,15+mouseY,45+mouseX,10+mouseY,46+mouseX,25+mouseY,43+mouseX,30+mouseY);
  
  //bow-knot
  fill(243,224,252);//set the colour to medium pink 
  ellipse(-5+mouseX,-18+mouseY,10,5);
  fill(252,250,255);//set the colour to pink high light
  triangle(-25+mouseX,-10+mouseY,-10+pmouseX,-25+pmouseY,-5+mouseX,-15+mouseY);
  quad(-35+pmouseX,-15+pmouseY,-20+pmouseX,-35+pmouseY,-10+pmouseX,-25+pmouseY,-25+mouseX,-10+mouseY);
  quad(-48+pmouseX,-32+pmouseY,-30+pmouseX,-35+pmouseY,-19+pmouseX,-35+pmouseY,-35+pmouseX,-15+pmouseY);
  
  triangle(-5+mouseX,-15+mouseY,-3+pmouseX,-30+pmouseY,5+mouseX,-15+mouseY);
  quad(-3+pmouseX,-30+pmouseY,0+pmouseX,-36+pmouseY,18+pmouseX,-20+pmouseY,5+mouseX,-15+mouseY);
  quad(0+pmouseX,-36+pmouseY,10+pmouseX,-40+pmouseY,34+pmouseX,-38+pmouseY,18+pmouseX,-20+pmouseY);
  
  //hairpin
  fill(255);//set the colour to white
  quad(-14+mouseX,12+mouseY,-2+mouseX,-9+mouseY,0+mouseX,-8+mouseY,-10+mouseX,15+mouseY);
  quad(8+mouseX,19+mouseY,11+mouseX,0+mouseY,15+mouseX,1+mouseY,10+mouseX,20+mouseY);
  quad(-45+mouseX,5+mouseY,-25+mouseX,12+mouseY,-26+mouseX,14+mouseY,-46+mouseX,8+mouseY);
  
  //eyes layer1
  stroke(155,107,91,80);// set up the stroke to brown and made it transparency
  fill(111,194,207);//set the colour to sky blue
  ellipse(-17+mouseX,38+mouseY,14,22);//Left eye
  ellipse(16+mouseX,37+mouseY,17,23);//Right eye
  
  //eyes layer2
  noStroke();//no stroke for the shape
  fill(184,250,254);//set the colour to light blue
  ellipse(-17+mouseX,42+mouseY,8,10);//Left eye
  ellipse(16+mouseX,41+mouseY,9,11);//Right eye
  
  //eyes layer3
  fill(111,194,207);//set the colour to sky blue
  ellipse(-17+mouseX,40+mouseY,10,9);//Left eye
  ellipse(16+mouseX,39+mouseY,11,10);//Right eye
  
  //eyes layer3
  fill(255);//set the colour to white
  ellipse(-19+mouseX,35+mouseY,7,6);//Left eye
  ellipse(14+mouseX,33+mouseY,8,6);//Right eye
  
  //eyes layer4
  stroke(155,107,91);// set up the stroke to brown
  strokeWeight(2);
  noFill();
  arc(-17+mouseX,38+mouseY,19,22,PI, PI+PI-QUARTER_PI-(QUARTER_PI/2));//Left eye
  arc(17+mouseX,36+mouseY,20,23,PI+QUARTER_PI, PI+PI-(QUARTER_PI/2));//Right eye
  
  //mouth
  stroke(155,107,91,80);// set up the stroke in transparency
  fill(249,204,204);//set the colour to pink
  arc(1+mouseX,56+mouseY,10, 12, PI-PI-QUARTER_PI, PI+QUARTER_PI, CHORD); 
  
}