Jisoo Geum Project – 06

sketch

// Jisoo Geum
// Section B
// jgeum@andrew.cmu.edu 
// Project-06
var prevSec;
var millisRolloverTime;
var sx =[];
var sy =[];
var gx = [];
var gy = [];
var pr = 0;
var pg = 0;

function setup() {
    createCanvas(480, 480);
    millisRolloverTime = 0; 
    angleMode(DEGREES);
}

function draw() {
    background(188,236,235);
    var H = hour();
    var M = minute();
    var S = second();
    
    //shadow 
    noStroke();
    fill(148,219,217);
    ellipse(240,400,350,50);
    

    // top part of the pomegranate 
    var colR = map (H,0,24,82,224);
    var colG = map (H,0,24,193,0);
    fill(colR,colG,86);
    triangle(240,53,260,115,220,115);
    triangle(260,85,270,115,250,115);
    triangle(220,85,230,115,210,115);
    
    //body of the pomegranate 
    strokeWeight(10);
    stroke(colR,colG,86);// outer layer color changes every hour (from green to ) 
    fill(255,242,205); // inner layer color 
    rect(90,120,297,280,120); 
    noStroke();
    fill(165,0,70); // darker part inside the pomegranate  
    rect(111,140,256,241,100);
    fill(255,242,205); 
    rect(222,113,35,23,50); // tip part 
    rect(230,128,20,262); // the line that divides the pomegranate 
    
    // seeds 
    for(var i = 0; i < M; i++){
        // number of seeds change depending on the current minute 
        sx =[212,193,272,214,269,214,269,214,269,214,269,214,269,214,269,212,272,191,293,193,290,290,193,290,193,290,193,290,193,290,192,291,171,312,172,311,172,311,172,311,172,311,172,311,170,313,150,333,150,334,150,334,148,335,151,333,130,353,130,353];
        sy =[166,219,166,194,194,220,220,246,246,298,272,271,298,324,324,350,350,167,167,193,193,219,245,245,270,271,297,297,323,323,349,349,181,181,207,207,233,233,259,259,285,285,311,311,337,337,198,198,230,230,260,260,287,287,318,318,239,239,265,265];
        gx = [210,195,269,213,271,213,270,213,271,213,271,213,271,213,271,210,273,192,297,195,293,293,197,292,195,297,197,297,195,297,196,298,174,319,175,318,175,318,173,318,175,318,174,318,174,310,153,340,154,340,153,340,151,342,154,339,133,360,133,360];
        gy = [162,217,163,193,191,217,217,243,243,295,268,268,295,321,321,347,347,167,167,191,191,216,243,242,267,273,299,299,320,325,351,351,183,183,209,209,235,235,256,261,282,287,308,313,339,339,200,200,232,232,261,261,289,289,320,320,241,241,267,267];
        
        // to make the seeds rotate by seconds 
        push();
        var tilt = (S*(30));
        translate(sx[i], sy[i]);
        rotate(tilt); 
        fill(255, 63, 113);
        ellipse(0,0, 15, 22); 
        pop();

        //the white glow 
        fill(255);
        ellipse (gx[i],gy[i],5,5);
     
    }
}

I decided to use the seeds in a pomegranate to describe minutes and then make them rotate to represent seconds. The color of the pomegranate changes every hour, turning from green to red.

The most challenging part of this assignment was putting all the coordinates for the seed values. I knew that there would be a way to use ratio and for loop to avoid the tedious part, but I could not figure out how to use it with the minute () function.

The reason why I chose to make the colors change from green to red is to show how a pomegranate’s color changes over time as it becomes ripe.

Leave a Reply