Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/******************************************************************
* File Name: Poke
* Author: Maddi McDougall
* Date: Sept 15, 2015
* Description: An interactive drawing featuring two characters.
* The mouse controls the arm of one and so as the 'player' moves
* the arm towards the other their expressions change accordingly.
* The characters' bodies and the background also move depending 
* on where the mouse is.
******************************************************************/

void setup(){
//Set Size
  size(400,400);
  smooth();
  ellipseMode(CENTER);    
}

void draw() { 
//Create and Colour Background Bands
  noStroke();
  background(176,201,196); //clears background
  
  fill(143,171,169);
  quad(0,120-mouseY/16,400,-70-mouseY/16,400,400,0,400);

  fill(108,138,139);
  quad(0,240-mouseY/8,400,60-mouseY/8,400,400,0,400);

  fill(75,100,109);
  quad(0,370-mouseY/4,400,190-mouseY/4,400,400,0,400);

  fill(59,77,91);
  quad(0,500-mouseY/2.5,400,320-mouseY/2.5,400,510,0,510);

/************************************************************
*                       Businessman
************************************************************/
  //Legs
    noFill();
    stroke(14,12,16);
    strokeWeight(5);
    bezier(275+mouseX/30,300-mouseY/30,265,350,265,430,280,430);
    bezier(305+mouseX/30,300-mouseY/30,315,350,315,430,310,430);

  //Suit
    rectMode(CENTER);
    noStroke();
    fill(31,29,35);
    rect(290+mouseX/30,240-mouseY/30,40,140,0,0,300,300);
    //Neck
      fill(225,162,146);
      quad(290+mouseX/30,187-mouseY/30,303+mouseX/30,180-mouseY/30,290+mouseX/30,172-mouseY/30,278+mouseX/30,180-mouseY/30);
    //Lines on Suit
      noFill();
      stroke(17,15,21);
      strokeWeight(2.5);
      line(290+mouseX/30,210-mouseY/30,290+mouseX/30,280-mouseY/30);
      bezier(290+mouseX/30,280-mouseY/30,290+mouseX/30,290-mouseY/30,290+mouseX/30,300-mouseY/30,273+mouseX/30,300-mouseY/30);
      bezier(290+mouseX/30,280-mouseY/30,290+mouseX/30,290-mouseY/30,290+mouseX/30,300-mouseY/30,307+mouseX/30,300-mouseY/30);
    //Collar
      noStroke();
      fill(229,230,237);
      quad(290+mouseX/30,185-mouseY/30,303+mouseX/30,178-mouseY/30,290+mouseX/30,210-mouseY/30,278+mouseX/30,178-mouseY/30);
      fill(190,194,208);
      quad(290+mouseX/30,185-mouseY/30,295+mouseX/30,195-mouseY/30,290+mouseX/30,210-mouseY/30,285+mouseX/30,195-mouseY/30);
      fill(17,15,21);
      triangle(276+mouseX/30,170-mouseY/30,290+mouseX/30,210-mouseY/30,272+mouseX/30,190-mouseY/30);
      triangle(304+mouseX/30,170-mouseY/30,290+mouseX/30,210-mouseY/30,308+mouseX/30,190-mouseY/30);

  //Head
    fill(229,181-mouseX/45,156);
    ellipse(290+mouseX/30,120-mouseY/30,140,120);
    //Face
      //Mouth
        stroke(209,123-mouseX/45,109);
        strokeWeight(3.5);
        bezier(280+mouseX/30,(145+mouseX/30)-mouseY/30,
        280+mouseX/30,(145-mouseX/30)-mouseY/30,
        300+mouseX/30,(145-mouseX/30)-mouseY/30,
        300+mouseX/30,(145+mouseX/30)-mouseY/30);
      //Eyes
        noStroke();
        fill(11,9,8);
        ellipse(268+mouseX/30,120-mouseY/30,16,40);
        ellipse(312+mouseX/30,120-mouseY/30,16,40);
      //Quads to cover top part of ellipes (eyes)
        noStroke();
        fill(229,181-mouseX/45,156);
        quad(255+mouseX/30,120-mouseY/30,280+mouseX/30,(120+mouseX/60)-mouseY/30,280+mouseX/30,90-mouseY/30,255+mouseX/30,90-mouseY/30);
        quad(300+mouseX/30,(120+mouseX/60)-mouseY/30,325+mouseX/30,120-mouseY/30,325+mouseX/30,90-mouseY/30,300+mouseX/30,90-mouseY/30);
      //Eyebrows
        stroke(11,9,8);
        line(255+mouseX/30,120-mouseY/30,280+mouseX/30,(120+mouseX/60)-mouseY/30);
        line(300+mouseX/30,(120+mouseX/60)-mouseY/30,325+mouseX/30,120-mouseY/30);

  //Hair
    noStroke();
    fill(79,48,36);
    quad(220+mouseX/30,120-mouseY/30,220+mouseX/30,90-mouseY/30,240+mouseX/30,65-mouseY/30,260+mouseX/30,80-mouseY/30);
    quad(250+mouseX/30,90-mouseY/30,245+mouseX/30,60-mouseY/30,280+mouseX/30,50-mouseY/30,320+mouseX/30,90-mouseY/30);
    quad(280+mouseX/30,50-mouseY/30,340+mouseX/30,65-mouseY/30,360+mouseX/30,100-mouseY/30,300+mouseX/30,90-mouseY/30);
    triangle(350+mouseX/30,90-mouseY/30,360+mouseX/30,100-mouseY/30,360+mouseX/30,120-mouseY/30);

  //Arms
    noFill();
    stroke(17,15,21);
    strokeWeight(5);
    bezier(270+mouseX/30,180-mouseY/30,240+mouseX/30,220-mouseX/7,230+mouseX/30,260-mouseX/16,260+mouseX/30,310-mouseX/14);
    bezier(310+mouseX/30,180-mouseY/30,340+mouseX/30,220-mouseX/7,350+mouseX/30,260-mouseX/16,320+mouseX/30,310-mouseX/14);
    
/************************************************************
*                       Pokerman
************************************************************/
  //Legs
    noFill();
    stroke(15,15,30);
    strokeWeight(5);
    bezier(95+mouseX/20,300+mouseY/20,85+mouseX/20,350,85,430,90,430);
    bezier(125+mouseX/20,300+mouseY/20,135+mouseX/20,350,135,430,130,430);

  //Shirt
    rectMode(CENTER);
    noStroke();
    fill(15,15,30);
    rect(110+mouseX/20,240+mouseY/20,40,140,0,0,300,300);
    fill(139,49,48);
    rect(110+mouseX/20,230+mouseY/20,40,120);
    ellipse(110+mouseX/20,290+mouseY/20,40,20);
    //Stripes
      fill(191);
      quad(90+mouseX/20,200+mouseY/20,130+mouseX/20,210+mouseY/20,130+mouseX/20,230+mouseY/20,90+mouseX/20,220+mouseY/20);
      quad(90+mouseX/20,230+mouseY/20,130+mouseX/20,240+mouseY/20,130+mouseX/20,250+mouseY/20,90+mouseX/20,240+mouseY/20);
    //Neck
      fill(236,158,133);
      ellipse(110+mouseX/20,176+mouseY/20,26,24);

  //Hair Behind Head
    noStroke();
    fill(255,209,160);
    triangle(50+mouseX/20,90+mouseY/20,50+mouseX/20,126+mouseY/20,20+mouseX/20,125+mouseY/20);
    triangle(50+mouseX/20,110+mouseY/20,60+mouseX/20,130+mouseY/20,30+mouseX/20,140+mouseY/20);
    triangle(160+mouseX/20,90+mouseY/20,200+mouseX/20,118+mouseY/20,160+mouseX/20,120+mouseY/20);
    triangle(160+mouseX/20,90+mouseY/20,190+mouseX/20,135+mouseY/20,160+mouseX/20,140+mouseY/20);

  //Head
    fill(243,177,142);
    ellipse(110+mouseX/20,120+mouseY/20,140,120);
    //Face
      //MouthOpen
        stroke(215,121,102);
        strokeWeight(2.5);
        fill(233,141,121);
        ellipse(110+mouseX/20,(135-mouseX/200)+mouseY/20,26,0+mouseX/7);
      //Rectangle to cover top half of ellipse (mouth)
        noStroke();
        fill(243,177,142);
        rect(110+mouseX/20,(110-mouseX/200)+mouseY/20,28,50);
      //Mouth
        stroke(215,121,102);
        strokeWeight(3.5);
        line(96+mouseX/20,(135-mouseX/200)+mouseY/20,124+mouseX/20,(135-mouseX/200)+mouseY/20);
    //Eyes
      noStroke();
      fill(11,9,8);
      ellipse(88+mouseX/20,(120+mouseX/180)+mouseY/20,16,40);
      ellipse(132+mouseX/20,(120+mouseX/180)+mouseY/20,16,40);
      fill(255);//whites
      ellipse(90+mouseX/20,(110+mouseX/180)+mouseY/20,4,8);
      ellipse(133+mouseX/20,(110+mouseX/180)+mouseY/20,4,8);
    //Cheeks
      fill(236,158,133);
      ellipse((80+mouseX/220)+mouseX/20,(140-mouseX/90)+mouseY/20,32+mouseX/150,32+mouseX/130);
      ellipse((140-mouseX/220)+mouseX/20,(140-mouseX/90)+mouseY/20,32+mouseX/150,32+mouseX/130);

  //Hair
    noStroke();
    fill(255,209,160);
    quad(40+mouseX/20,120+mouseY/20,40+mouseX/20,90+mouseY/20,55+mouseX/20,65+mouseY/20,70+mouseX/20,80+mouseY/20);
    triangle(64+mouseX/20,80+mouseY/20,70+mouseX/20,110+mouseY/20,40+mouseX/20,100+mouseY/20);
    triangle(60+mouseX/20,90+mouseY/20,70+mouseX/20,50+mouseY/20,100+mouseX/20,100+mouseY/20);
    quad(80+mouseX/20,80+mouseY/20,70+mouseX/20,70+mouseY/20,95+mouseX/20,40+mouseY/20,120+mouseX/20,100+mouseY/20);
    quad(90+mouseX/20,65+mouseY/20,120+mouseX/20,40+mouseY/20,143+mouseX/20,55+mouseY/20,160+mouseX/20,110+mouseY/20);
    triangle(110+mouseX/20,70+mouseY/20,160+mouseX/20,58+mouseY/20,190+mouseX/20,100+mouseY/20);
    quad(155+mouseX/20,80+mouseY/20,172+mouseX/20,80+mouseY/20,178+mouseX/20,90+mouseY/20,180+mouseX/20,120+mouseY/20);

  //Arms
    noFill();
    stroke(74,28,34);
    strokeWeight(5);
    bezier(90+mouseX/20,180+mouseY/20,
    (40+mouseX/20)+mouseX/20,(240-mouseX/40)+mouseY/20,
    (90+mouseX/20)+mouseX/20,(280+mouseX/15)+mouseY/20,
    (70-mouseX/40)+mouseX/20,(310-mouseX/10)+mouseY/20);
    bezier(130+mouseX/20,180+mouseY/20,
    (180+mouseX/30)+mouseX/20,(240+mouseY/30)+mouseY/20,
    (130+mouseX/10)+mouseX/20,(280+mouseY/10)+mouseY/20,
    mouseX,mouseY); //One that moves
}

//If mouse is pressed show message and create a white circle
void mousePressed(){
  println("Poke!");
  noStroke();
  fill(255);
  ellipse(mouseX,mouseY,10,10);
}