Project 06: tap tap

sketch

/* Samantha Ho
Section E 
sch1@andrew.cmu.edu
Assignment 03A*/

var x;
var y;
var m;
var size;
 

function setup() {
    createCanvas(500, 500);
    frameRate(10);
    
}
 /*
function isEven(tapIndex) {
   return tapIndex % 2 == 0;
}

function isOdd(n) {
   return Math.abs(tapIndex % 2) == 1;
} */

function draw() {
    background(240,250,255);
    noStroke();
    //time variables
    var tapIndex= second();
    var tapMiddle = minute();
    var tapThumb= hour();
    
    //THUMB 
    //raising and lifting the thumb every other hour
    if (tapThumb % 2 ==0){
    //thumb
    fill(251,189,154);
    beginShape();
    curveVertex(125, 290);
    curveVertex(86, 300);
    curveVertex(86,285);
    curveVertex(108, 270);
    curveVertex(114, 265);
    curveVertex(125, 260);
    endShape(CLOSE);
    //nail
    fill(255,255,255);
    beginShape();
    curveVertex(100, 280);
    curveVertex(86, 293);
    curveVertex(86,285);
    curveVertex(110, 266);
    curveVertex(106, 265);
    curveVertex(108, 260);
    endShape(CLOSE);
   } else{
       //thumb
    fill(251,189,154);
    beginShape();
    curveVertex(125, 280);
    curveVertex(86, 290);
    curveVertex(86, 280);
    curveVertex(108, 266);
    curveVertex(114, 265);
    curveVertex(125, 260);
    endShape(CLOSE);
    //nail
    fill(255,255,255);
    beginShape();
    curveVertex(98, 280);
    curveVertex(86, 283);
    curveVertex(86, 280);
    curveVertex(98, 266);
    curveVertex(100, 265);
    curveVertex(102, 260);
    endShape(CLOSE);
}
    
    
    
    //INDEX FINGER
    //tapping the index finger once every other second
    if (tapIndex % 2 ==0){
    //Index finger
    fill(251,189,154);
    beginShape();
    curveVertex(140, 235);
    curveVertex(140, 235);
    curveVertex(150, 245);
    curveVertex(150, 300);
    curveVertex(130, 300);
    curveVertex(130,245);
    endShape(CLOSE);
    //nail
    fill(251,255,255);
    beginShape();
    curveVertex(140, 283);
    curveVertex(140, 283);
    curveVertex(147, 286);
    curveVertex(147, 299);
    curveVertex(132, 299);
    curveVertex(132,286);
    endShape(CLOSE);
    } 
    //lift the index finger
    else {
   fill(251,189,154);
    beginShape();
    curveVertex(140, 235);
    curveVertex(140, 235);
    curveVertex(150, 245);
    curveVertex(150, 290);
    curveVertex(130, 290);
    curveVertex(130,245);
    endShape(CLOSE);
        
    //nail
     fill(251,255,255);
    beginShape();
    curveVertex(140, 272);
    curveVertex(140, 272);
    curveVertex(147, 274);
    curveVertex(147, 284);
    curveVertex(132, 284);
    curveVertex(132,274);
    endShape(CLOSE);
    }
    
    //MIDDLE FINGER
    //tapping middle finger every other minute
    if (tapMiddle % 2 == 0){
    //middle finger
    fill(251,189,154);
    beginShape();
   curveVertex(164, 230);
    curveVertex(164, 230);
    curveVertex(175, 240)
    curveVertex(175, 300);
    curveVertex(155, 300);
    curveVertex(155,240);
    endShape(CLOSE);
    //nail
   fill(251,255,255);
    beginShape();
    curveVertex(168, 283);
    curveVertex(168, 283);
    curveVertex(172, 286);
    curveVertex(172, 300);
    curveVertex(158, 300);
    curveVertex(158, 286);
    endShape(CLOSE);
    }else{
    //middle finger
    fill(251,189,154);
    beginShape();
   curveVertex(164, 230);
    curveVertex(164, 230);
    curveVertex(175, 240)
    curveVertex(174, 289);
    curveVertex(155, 289);
    curveVertex(155,240);
    endShape(CLOSE);
    //nail
   fill(251,255,255);
    beginShape();
    curveVertex(166, 272);
    curveVertex(166, 272);
    curveVertex(172, 274);
    curveVertex(172, 284);
    curveVertex(158, 284);
    curveVertex(158, 274);
    endShape(CLOSE);
    }
    
    
    //RING FINGER   
    fill(251,189,154);
    beginShape();
    curveVertex(190, 230);
    curveVertex(190, 230);
    curveVertex(200, 240)
    curveVertex(200, 300);
    curveVertex(180, 300);
    curveVertex(180,240);
     endShape(CLOSE);
    //nail
    fill(251,255,255);
    beginShape();
    curveVertex(190, 282);
    curveVertex(190, 282);
    curveVertex(197, 286);
    curveVertex(197, 300);
    curveVertex(184, 300);
    curveVertex(183, 286);
    endShape(CLOSE);
    
    
    //PINKY FINGER   
    fill(251,189,154);
    beginShape();
    curveVertex(216, 242);
    curveVertex(216, 242);
    curveVertex(223, 250)
    curveVertex(223, 300);
    curveVertex(205, 300);
    curveVertex(205, 250);
    endShape(CLOSE);
    //nail
    fill(251,255,255);
    beginShape();
    curveVertex(214, 284);
    curveVertex(214, 284);
    curveVertex(220, 286);
    curveVertex(220, 300);
    curveVertex(208, 300);
    curveVertex(208, 286);
    endShape(CLOSE);
}

  

This is my abstract clock. It was challenging to get the fingers to tap and I ended up using a modulus to determine if the number values were even or odd. Pretty proud of myself to be honest. The index finger taps every other second, the middle finger every other minute, and lastly the thumb every other hour.

Leave a Reply