Jamie Dorst Project 06 Abstract Clock

sketch

/*
Jamie Dorst
jdorst@andrew.cmu.edu
Section A
Project-06
*/

//VARIABLES
//shelf height
var shelfY = [100, 220, 340, 460];

// flame vertices
var flameX1 = 35;
var flameY1 = 40;
var flameX2 = 45;
var flameX3 = 40;
var flameY3 = 20;
// candle width
var candleW = 30;
// candle x positions array
// 6 variables, same in every column, increasing by 80
var candleX = [25, 105, 185, 265, 345, 425];
// candle y positions array
// 4 variables, same in every row
var candleY = [];
// candle heights
// one for each candle
var candleH = [];
// color arrays
var flameColors = ['orange', 'gold'];
var fColor = 0;
var woodColors = ['saddlebrown', 'peru'];
var wColor = 0;

function setup() {
    createCanvas(480, 480);
    
}

function draw() {
    background('black');
    // time variables
    var h = hour();
    var m = minute();
    var s = second();
    noStroke();

    // WOOD SHELVES
    // alternate wood color every minute
    if (m % 2 === 0) {
        wColor = 0;
    } else {
        wColor = 1;
    }
    // draw four shelves
        fill(woodColors[wColor]);
        rect(0, shelfY[0], 480, 20);
        rect(0, shelfY[1], 480, 20);
        rect(0, shelfY[2], 480, 20);
        rect(0, shelfY[3], 480, 20);

    // CANDLES
    // fill in y position array with 24 values
    // groups of 6, each increasing by 120
    // will change individually later as candles melt
    for (var i = 0; i < 6; i++) {
        candleY[i] = 40;
    }
    for (var i = 6; i < 12; i++) {
        candleY[i] = 160;
    }
    for (var i = 12; i < 18; i++) {
        candleY[i] = 280;
    }
    for (var i = 18; i < 24; i++) {
        candleY[i] = 400;
    }
    // fill in height array with 24 values of 60
    for (var k = 0; k < 24; k++) {
        candleH[k] = 60;
    }
    // one candle melts per hour
    for (var p = 0; p < 24; p++) {
        if (p < h) {
            candleH[p] = 0;
            candleY[p] = 0;
        } else if (p === h) {
            candleH[p] = candleH[p] - (candleH[p] * (m / 60));
            if (h < 6) {
                candleY[p] = shelfY[0] - candleH[p];
            }
            if (h >= 6 & h < 12) {
                candleY[p] = shelfY[1] - candleH[p];
            }
            if (h >= 12 & h < 18) {
                candleY[p] = shelfY[2] - candleH[p];
            }
            if (h >= 18 & h < 24) {
                candleY[p] = shelfY[3] - candleH[p];
            }
        }
    }
    // make four groups of six to draw the candles
    fill('white');
    // first row
    rect(candleX[0], candleY[0], candleW, candleH[0]);
    rect(candleX[1], candleY[1], candleW, candleH[1]);
    rect(candleX[2], candleY[2], candleW, candleH[2]);
    rect(candleX[3], candleY[3], candleW, candleH[3]);
    rect(candleX[4], candleY[4], candleW, candleH[4]);
    rect(candleX[5], candleY[5], candleW, candleH[5]);
    // second row
    rect(candleX[0], candleY[6], candleW, candleH[6]);
    rect(candleX[1], candleY[7], candleW, candleH[7]);
    rect(candleX[2], candleY[8], candleW, candleH[8]);
    rect(candleX[3], candleY[9], candleW, candleH[9]);
    rect(candleX[4], candleY[10], candleW, candleH[10]);
    rect(candleX[5], candleY[11], candleW, candleH[11]);
    // third row
    rect(candleX[0], candleY[12], candleW, candleH[12]);
    rect(candleX[1], candleY[13], candleW, candleH[13]);
    rect(candleX[2], candleY[14], candleW, candleH[14]);
    rect(candleX[3], candleY[15], candleW, candleH[15]);
    rect(candleX[4], candleY[16], candleW, candleH[16]);
    rect(candleX[5], candleY[17], candleW, candleH[17]);
    // fourth row
    rect(candleX[0], candleY[18], candleW, candleH[18]);
    rect(candleX[1], candleY[19], candleW, candleH[19]);
    rect(candleX[2], candleY[20], candleW, candleH[20]);
    rect(candleX[3], candleY[21], candleW, candleH[21]);
    rect(candleX[4], candleY[22], candleW, candleH[22]);
    rect(candleX[5], candleY[23], candleW, candleH[23]);

    // FLAMES
    // alternate flame color every second
    // draw flames
    if (s % 2 === 0) {
        fColor = 0;
    } else {
        fColor = 1;
    }
    fill(flameColors[fColor]);
    // move flames to follow candles
    for (var j = 0; j < 6; j++) {
        if (j === h) {
            flameX1 = candleX[j] + 10;
        }
    }
    for (var j = 6; j < 12; j++) {
        if (j === h) {
            flameX1 = candleX[j - 6] + 10;
        }
    }
    for (var j = 12; j < 18; j++) {
        if (j === h) {
            flameX1 = candleX[j - 12] + 10;
        }
    }
    for (var j = 18; j < 24; j++) {
        if (j === h) {
            flameX1 = candleX[j - 18] + 10;
        }
    }
    flameY1 = candleY[h];
    flameX2 = flameX1 + 10;
    flameX3 = flameX1 + 5;
    flameY3 = flameY1 - 20;
    triangle(flameX1, flameY1, flameX2, flameY1, flameX3, flameY3);
}

For this week’s project, I made a clock based on 24 candles, where the flame changes color every second, the wooden shelves change color every minute, and one candle melts per hour. I wanted to show time as something that we run out of every day, to give perspective on how we use it. I struggled a lot with this project; I didn’t realize how complicated it would be. But, I think I also learned a lot from it and I’m very satisfied that I got it to work in the end.

Joanne Lee – Project 06

Project-06

// Joanne Lee
// Section C
// joannele@andrew.cmu.edu
// Project-06

var skyR = 135;
var skyG = 206;
var skyB = 235;
var grassR = 206;
var grassG = 229;
var grassB = 178;


function setup() {
  createCanvas(375,480);
}

function draw() {

  // hour hand -- represented by background colors // 12 hr clock
  var h = hour() % 12;
  noStroke();
  background(skyR - 10 * h, skyG - 20 * h, skyB - 20 * h); // sky --> darkens every 12 hours
  fill(grassR - 30 * h, grassG - 50 * h, grassB - 20 * h, 99); // darkens every 12 hours
  triangle(0, height * 0.75, 0, height, 1500, height); // plain 1
  triangle(width, height * 0.55, width, height, -1500, height); // plain 2

  // minute hand -- represented by the sun position
  var m = minute() / 60;

  push();
  noStroke();
  if (m < 0.25 || m > 0.75) { // make opaque when not in sky
    fill(255, 200, 100, 50);
  }
  else {
    fill(255, 200, 100);
  }
  translate(width / 2, height / 2);
  rotate(radians(m * 360));
  ellipse(0, 200, 60, 60);
  pop();

  // second hand -- represented by the clouds
  var s = second() / 60;
  var x1 = -80; // x-values to keep cloud off screen, keeping continuous movement
  var x2 = -120;
  var x3 = -40;
  var shift = (width+160) * s; // move across screen proportionally

  push();
  noStroke();
  fill(255);
  ellipse(x1 + shift, 110, 120, 65);
  ellipse(x2 + shift, 110, 90, 45);
  ellipse(x3 + shift, 116, 100, 40);
  pop();
}

Going into the project, I knew I wanted to make use of background color changes as well as real elements on the screen moving (i.e. cloud, sun).

The hour hand is denoted by the change in sky / grass color. Over the progression of 12 hours, the sky and grass becomes darker in color. I chose to do a 12 hour clock because I wanted the hour hand differences to be more apparent. The minute hand is denoted by the position of the sun. As you can see in my sketch below, I originally intended for the sun to go off screen, but I wanted it to be more clear what the current minutes were. Therefore, I decided to keep it on the screen and make it more opaque as to not draw too much attention through the grass. And finally, the seconds are denoted by the pace of the cloud moving across the screen in what appears to be a continuous loop. I personally found this project to be one of the most interesting projects to work on so far.

Original sketch for abstract clock

Kai Zhang-Project-06-Abstract-Clock

sketch

//Kai Zhang
//Section B
//kaiz1@andrew.cmu.edu
//Project-06

var prevSec; //previous second
var msr = 0;//millisecond rollover
var wcol = 0; //wallpaper color
var scol = 0; //second loop color
var mcol = 0; //minute loop color
var hcol = 0; //hour loop color

function setup() {
    createCanvas(600, 600);
    colorMode(HSB, 100);
}

function draw() {
    var h = hour();
    var m = minute();
    var s = second();
    var mils; //millisecond
    var fcd = 0; //frame count decrease


    background(wcol, 40, 30);
    angleMode(RADIANS);

    wcol += 0.1;
    if (wcol > 99) {
        wcol = 0;
    }
    
    strokeWeight(4);
    stroke(20);
    noFill();

    if (prevSec != s) {
        msr = millis();
    }
    prevSec = s;
    var mils = floor(millis() - msr);

    
    //hour loop
    push();
    translate(300, 410);

    stroke(40);
    for (var size = 320; size < 401; size += 20) {
        ellipse(0, 0, size, 100);
    }

    stroke(hcol + 75, 40, 90);
    for (var size = 320; size < 401; size += 20) {
        arc(0, 0, size, 100, -PI / 2, h/12 * 2*PI - PI / 2);
    }

    hcol += 0.1;
    if (hcol > 25) {
        hcol = -75;
    }
    pop()


    //minute loop
    push()
    translate(300, 340);

    stroke(40);
    for (var size = 320; size < 401; size += 20) {
        ellipse(0, 0, size, 100);
    }

    stroke(mcol + 50, 40, 90);
    for (var size = 320; size < 401; size += 20) {
        arc(0, 0, size, 100, -PI / 2, m/60 * 2*PI - PI / 2);
    }


    mcol += 0.1;
    if (mcol > 50) {
        mcol = -50;
    }
    pop()


    //second loop
    push()
    translate(300, 270);

    stroke(40);
    for (var size = 320; size < 401; size += 20) {
        ellipse(0, 0, size, 100);
    }

    stroke(scol + 25, 40, 90);
    for (var size = 320; size < 401; size += 20) {
        arc(0, 0, size, 100, -PI / 2, (s/60 + mils/60000) * 2*PI - PI / 2);
    }

    scol += 0.1;
    if (scol > 75) {
        scol = -25;
    }
    pop()


    
    //mils loop
    push()
    translate(300, 200);
    stroke(77);
    strokeWeight(4);
    arc(0, 0, 320, 100, millis()/1000 * 2*PI, (millis() - 200)/1000 * 2*PI);
    arc(0, 0, 340, 100, (millis() - 100)/1000 * 2*PI, (millis() - 300)/1000 * 2*PI);
    arc(0, 0, 360, 100, (millis() - 200)/1000 * 2*PI, (millis() - 400)/1000 * 2*PI);
    arc(0, 0, 380, 100, (millis() - 300)/1000 * 2*PI, (millis() - 600)/1000 * 2*PI);
    arc(0, 0, 400, 100, (millis() - 400)/1000 * 2*PI, (millis() - 800)/1000 * 2*PI);
    pop()
}

For this project I’m also considering an apporach to do a 3 dimensional abstract clock using 2D primitives. There are 4 sets of loops running on the tracks stacking bottom up and each shows the hour, minute, second, and milisecond. However, the milisecond loops are moving too fast so I rather make it a infinite looping than resetting at each second. The color of the loops and background are also changing the hue constantly, and they’re offest in H value so they’re always in contrast colors.

Eunice Choe – Project-06 – Abstract Clock

sketch

/* Eunice Choe
Section E
ejchoe@andrew.cmu.edu
Project 06*/

// global variables for wheel position and size
var bigX = 160;
var bigY = 320;
var bigDiam = 200;
var smallX = 370;
var smallDiam = 70;

function setup() {
    createCanvas(480, 480);
}

function draw() {
    background(172, 201, 232);
    angleMode(DEGREES);
    var H = hour();
    var M = minute();
    var S = second();
    var cH = map(H, 0, 23, 50, width - 50);
    // sidewalk
    noStroke();
    fill(171, 184, 182);
    rect(0, 320, width, 320);
    // changing sun position depending on the hour
    // changing from sun to moon depending on time
    // 7AM to 7PM shows sun while 7PM to 7AM shows moon
    if(H < 19 & H > 7){
        noStroke();
        fill(237, 232, 73);
    } else {
        fill(88, 92, 94);
    }
    ellipse(cH, 100, 100, 100);
    // Time text
    strokeWeight(0.5);
    fill(82, 9, 6);
    textAlign(CENTER);
    text("Hour: " + H, cH, 100);
    text("Minute: " + M, smallX, 450);
    text("Second: " + S, bigX, 450);
    // thin red bike part
    strokeWeight(10);
    stroke(82, 9, 6)
    line(bigX + 110, bigY - 110, bigX + 120, bigY - 130);
    // yellow bike parts
    stroke(176, 117, 15);
    line(bigX + 30, bigY - 200, bigX + 35, bigY - 230);
    line(bigX + 35, bigY - 230, bigX, bigY - 250);
    line(bigX, bigY - 250, bigX - 20, bigY - 240);
    ellipse(bigX, bigY - 250, 10, 10);
    // bike seat
    fill(176, 117, 15);
    line(bigX + 90, bigY - 160, bigX + 120, bigY - 150);
    ellipse(bigX + 130, bigY - 150, 20, 15);
    // thick red bike parts
    stroke(82, 9, 6);
    strokeWeight(15);
    line(bigX, bigY, bigX + 30, bigY - 200);
    line(bigX + 30, bigY - 160, bigX + 120, bigY - 100);
    line(bigX + 120, bigY - 100, smallX, bigY + bigDiam / 2 - smallDiam / 2);
    // wheels
    noFill();
    strokeWeight(15);
    stroke(255, 250, 202);
    ellipse(bigX, bigY, bigDiam, bigDiam);
    ellipse(smallX, bigY + bigDiam / 2 - smallDiam / 2, smallDiam, smallDiam);
    // the rotating seconds wheel
    for(var s = 0; s < S; s++){
        push();
        translate(bigX, bigY);
        rotate(6 * s); // 60 seconds - 60 spokes
        stroke(255);
        strokeWeight(2);
        line(0, 0, 0, -100);
        pop();
    }
    // the rotating minutes wheel
    for(var m = 0; m < M; m++){
        push();
        translate(smallX, bigY + bigDiam / 2 - smallDiam / 2);
        rotate(6 * m); // 60 minutes - 60 spokes
        stroke(255);
        strokeWeight(1);
        line(0, 0, 0, -35);
        pop();
    }

}

My abstract clock is a bicycle with the big wheel representing seconds, the small wheel represent minutes, and the sun/moon representing the hour. For the second and minute wheels, new spokes appear after every second/minute passes. From 7AM to 7PM, the sun is yellow and from 7PM to 7AM the circle turns gray to represent the moon. In addition, the position of the sun/moon changes depending on what time it is.

I came up with the idea of a bike because of the two circular shapes I could work with to represent minutes and seconds. I had to get a little creative to represent the hours, so I chose to use something in the background. The abstract clock was difficult to figure out at times, but overall I feel better about applying rotation and for loops into my code.




The bike in day time and night time.

Jenni Lee — Project 06 — Abstract Clock

sketch

/* Jenni Lee
Section E
jennife5@andrew.cmu.edu
Project - 06
*/

function setup() {
  createCanvas(600, 800);
}

function draw() {
  var H = hour(); // brightness of the background is controlled by the hour
  var bgr = 174 * (24 - H) / 24; // range of r is 42 to 216
  var bgg = 166 * (24 - H) / 24; // range of g is 73 to 239
  var bgb = 167 * (24 - H) / 24; // range of b is 73 to 240
  background(bgr + 42, bgg + 73, bgb + 73); 
 
 // brightness of grass is controlled by color
  bgr = 173 * (24 - H) / 24; // range of r is 57 to 230
  bgg = 156 * (24 - H) / 24; // range of g is 81 to 237
  bgb = 125 * (24 - H) / 24; // range of b is 51 to 176
  noStroke();
  fill (bgr + 57, bgg + 81, bgb + 51);
  rect (0, 600, 600, 200);

  // tail
  push();
  translate(400, 510);
  var S = second() % 2;
  if (S == 0) { // tail points to different direction depending on even or odd second number
    rotate(60 / PI + PI);
  } else {
    rotate(120 / PI + PI);
  }
  noStroke();
  ellipseMode(CORNER);
  fill (247, 202, 201);
  ellipse(0, 0, 40, 140);
  pop();

  // body
  push();
  translate(300, 570);
  noStroke();
  fill(229, 196, 168);
  ellipse(0, 0, 250, 200);
  pop();

  // face
  push();
  translate(200, 580);
  noStroke();
  fill(239, 208, 172);
  ellipse(0, 0, 200, 150);
  pop();

  //ears
  push ();
  noStroke();
  fill(239, 208, 172); // left ear
  triangle(100, 572, 102, 490, 150, 515); 
  fill (252, 217, 224); // left inner ear
  triangle(108, 561, 110, 510, 138, 528); 

  //right ear
  fill(239, 208, 172); // right ear
  triangle(240, 512, 290, 490, 295, 560); 
  fill (252, 217, 224); // right inner ear
  triangle(250, 521, 282, 506, 285, 553); 
  pop ();

  // eyes. the posiiton of the eye ball is decided by 
  // the minutes, and it circles one round in 60 minutes
  push(); 
  translate(140, 570);
  noStroke ();
  fill(255, 255, 255);
  // left eye
  ellipse(0, 0, 36, 36);
  //left eye ball
  var M = minute();
  angleMode(DEGREES);
  fill(130, 115, 100);
  ellipse(cos(M / 60 * 360 - 90) * 9, sin(M / 60 * 360 - 90) * 9, 18, 18);

  // right eye
  fill(255, 255, 255);
  ellipse(100, 0, 36, 36); 
  // right eye ball
  fill(130, 115, 100);
  ellipse(cos(M / 60 * 360 - 90) * 9 + 100, sin(M / 60 * 360 - 90) * 9, 18, 18);
  angleMode(RADIANS);

  // nose
  fill(130, 115, 100);
  ellipse(50, 20, 10, 10); 

  //blush
  fill(252, 217, 224);
  ellipse(5, 30, 35, 10); // left blush
  ellipse(95, 30, 35, 10); // right blush
  pop();

  // left paw
  push();
  translate(152, 650);
  rotate(40 / PI);
  strokeWeight(3);
  stroke(255);
  fill(239, 208, 172);
  ellipse(0, 0, 80, 40);
  pop();

  // right paw
  push();
  translate(232, 650);
  rotate(-40 / PI);
  strokeWeight(3);
  stroke(255);
  fill(239, 208, 172);
  ellipse(0, 0, 80, 40);
  pop();
}
// The tail moves left and right every second, the eyeballs make a 360 rotation each hour,
// it moves clock wise every minute. The sky gets darker with each hour. It's the brightest
// at the beginning of the day and dark at the end of the day. 

Cats are my favorite animal, so I wanted my abstract clock to be one. This project was highly enjoyable for me, as not only was it a fun challenge to design it, but it was entertaining to fully customize it to my own tastes. Seconds are indicated by the tail moving left and right each second. Minutes are indicated with the eyeballs moving clock wise every minute, completing a 360 rotation by the end of the hour. Hours/time of day is indicated through the ground and sky getting darker with each hour of the day. These two elements are very light in the morning and dark at night, similar to the sun setting.

Process work ^

Project-06-Abstract Clock-Veronica

sketch

/*
Veronica Wang
Section B
yiruiw@andrew.cmu.edu
Project 06
*/

var prevSec;
var millisRolloverTime;

function setup() {
    createCanvas(600, 600);
    millisRolloverTime = 0;
}

function draw() {
    background(30);
    
    // Fetch the current time
    var H = hour();
    var M = minute();
    var S = second();
    
    // Reckon the current millisecond, 
    // particularly if the second has rolled over.
    if (prevSec != S) {
        millisRolloverTime = millis();
    }
    prevSec = S;
    var mils = floor(millis() - millisRolloverTime);
  
    //text label of time  
    noStroke();
    fill('white');
    text("Hour: "   + H, 10, 22);
    text("Minute: " + M, 10, 42);
    text("Second: " + S, 10, 62);
    text("Millis: " + mils, 10, 82);

    
    //hour ellipse and arc
    stroke('gold');
    var hourR = 150;
    var color = 'gold';
    fill(30);
    ellipse(width / 3, height / 3, hourR * 2, hourR * 2);
    timefiller(24, H, width/3, height/3, hourR, color);

    //minute ellipse and arc
    stroke('skyblue');
    var minR = 100;
    color = 'skyblue';
    noFill();
    ellipse(width * 0.45, height * 0.5, minR * 2, minR * 2);
    timefiller(60, M, width * 0.45, height * 0.5, minR, color);

    //second ellipse and arc
    stroke('lightblue');
    var secR = 75;
    color = 'lightblue';
    noFill();
    ellipse(width * 0.6, height * 0.6, secR * 2, secR * 2);
    timefiller(60, S, width * 0.6, height * 0.6, secR, color);

    //milli second ellipse and arc
    stroke('white');
    var milR = 50;
    color = 'white';
    noFill();
    ellipse(width * 0.75, height * 0.6, 100, 100);
    timefiller(1000, mils, width * 0.75, height * 0.6, milR, color);
    
    //function to draw arc based on division of circle
    function timefiller(divNum, currNum, x, y, r, color){
        var incr = 2 * PI / (divNum * 2); //divide circle into increments based on time unit
        var pt2 = currNum * incr + PI / 2; //time increment point on circle
        var pt1 = PI / 2 - currNum * incr; //time increment point on circle
        fill(color);
        arc(x, y, 2 * r, 2 * r, pt1, pt2, OPEN); //draw open arc based on current time increment points
        
    }





}

In this project I decided to represent the abstract clock with a series of circles being filled up. I challenged myself to write a new function for drawing those open arcs and it turned out just the way I intended. I had trouble figuring out the increments and correct elements to make the arc with, but it reminded me of the string art project which helped me a lot with this.

idea sketches

Sarah Yae Project 6 Section B

sketch

function setup() {
    createCanvas(300, 300);
}

function draw() {
    
    var H = hour();
    var M = minute();
    var S = second();

//Sky gets lighter with an hourly increment 
    background (0, 10 * H, 255);

//Sun moves position with the minute
    fill (250,218,94); 
    noStroke();
    ellipse (M * 5, 50, 50, 50);

//Cloud floats with the second
    fill('White');
    noStroke();
    arc(20 + S * 4,100,30,30, PI/2, 3*PI/2);

    fill('White');
    noStroke();
    arc(30 + S * 4,85,30,30, 3*PI/4, (3*PI/4) + 3*PI/2);

    fill('White');
    noStroke();
    arc(50 + S * 4,85,30,30, 3*PI/4, (3*PI/4) + 3*PI/2);

    fill('White');
    noStroke();
    arc(60 + S * 4,100,30,30, 3*PI/2, PI/2);

    fill ('White');
    noStroke();
    rect(20 + S * 4,85,40,30);

//Sand 
    fill (225,191,146);
    rect (0, 190, width, height);

//Sand particles
    for (var x = 0; x < width; x += 10) {
        for (var y = 210; y < height; y += 20) {
           textSize (25);
            fill(87,72,60);
            text ('.', x, y); 
        }   
    }
}

Original Sketch

I originally wanted to create a project that would continuously draw stars (constellation) as the seconds go by, but as I worked on the project, realized that I wanted to move an object across- thus, I used a cloud. I had a difficult time creating a shape of the cloud, so I decided to hardcode each piece of the cloud (4 arcs + 1 rectangle). I even had a difficult time getting ideas about how I would want my abstract clock to reflect… However, I am satisfied with my final outcome and how it turned out; I especially like the smooth transition of the background, which reflects the hour. A great addition would have been if the sky reflected the actual sky color at specific hours, instead of just going from dark blue to light blue.

ChristineSeo-Project06-SectionC

sketch

// Christine Seo
// Section C
// mseo1@andrew.cmu.edu
// Project-06

var r;
var b;
var g;
var prevSec; 
var a; // set to make the text move

function setup() {
  createCanvas(480, 480);
  prevSec = second();
  r = random(130,255);
 	g = random(110,255);
 	b = random(200,250);
  a = width / 2; 
}

function draw() {
  background(197, 234, 244);
  noStroke(0);
  fill(110, 75, 3); //outer donut
  ellipse(width / 2,height / 2,430,430);
  fill(229, 155, 201);
  
  push();
  translate(width / 2, height / 2);// pink frosting shape
	ellipse(0, 0, 382, 152);
  rotate(PI / 1.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 2.0);
	ellipse(0, 0, 382, 152);
  rotate(PI / 3.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 3.0);
	ellipse(0, 0, 382, 152);
  rotate(PI / 3.0);
	ellipse(0, 0, 382, 152);
  rotate(PI / 3.0);
	ellipse(0, 0, 382, 152);
  rotate(PI / 5.0);
	ellipse(0, 0, 382, 152);
  rotate(PI / 5.0);
	ellipse(0, 0, 382, 152);
  rotate(PI / 5.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 5.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 5.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 7.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 7.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 7.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 7.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 7.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 7.0);
	ellipse(0, 0, 382, 152);
	rotate(PI / 7.0);
	ellipse(0, 0, 382, 152);
  pop();
  
  fill(229, 155, 201);//frosting base
  ellipse(width / 2,height / 2,320,320);
  ellipse(width / 2 + 5,height / 2 + 5,320,320);
  fill(110, 75, 3);//inner donut
  ellipse(width / 2,height / 2,170,170);
  fill(197, 234, 244);
  ellipse(width / 2,height / 2,150,150);
  
  push();//sprinkles
	translate(width / 2, height / 2);
  for (var p = 0; p < minute(); p += 1){ //adds a sprinkle color every minute
    rotate(PI / 3.0); 
    fill(r,g,b); 
    rect(85,95 / 30 * p - 30,35,8,20);
}
  pop();
  
  
    fill(197, 234, 244);//bites
  for(var i = 0; i < hour(); i += 1){  
    if(i < 6){
    	ellipse(120 + i * 50,40,60,70);//40=spacing
    }
    else if(i < 12){
    	ellipse(33,i * 33,70,40);
    }
    else if(i < 18){
      ellipse(450,i * 21,70,30);
    }
    else if(i < 24){
      ellipse(i * 30 - 400,440,50,70);
      
    }
}
  push();
  strokeWeight(10); //donut highlight
  stroke(255);
  noFill(0);
  curve(380, 260, 415, 186, 360, 108, 70, 60);
  pop();
  
  fill(110, 75, 3); //text 
  textSize(32);
  textStyle(BOLD);
  a = a - 2.5;
  if (a < -width) {
  a = 150;
  }
  text('yum~', 10 - a, 40);
  fill(229, 155, 201);
  text('yum!', 10 - a, 460);
  
  fill(0);
  rect(180,240,45,12); //eyebrows
  rect(260,240,45,12);
	ellipse(210,280,45,50);//eyes base
  ellipse(270,280,45,50);
  fill(255);
  ellipse(210,283,30,40); // eye whites
  ellipse(270,283,30,40);
  fill(0);
  ellipse(270,290,15,25); //eye inside
  ellipse(210,290,15,25);
  fill(255); //eye inside inside
  ellipse(208,285,5,5);
  ellipse(268,285,5,5);
  
  if(second() != prevSec){ //sprinkles color
 		 prevSec = second();
 		r =random(130,255);
 		g =random(110,255);
 		b = random(200,250);//changes color every second every time value is different from the previous second 
  fill(0);
  ellipse(210,280,45,50);
  ellipse(270,280,45,50);
 		}
}

For this project, I wanted to portray a fun and exciting theme: a donut! Every second, the sprinkles on the donut changes color. Also, there is a visual representation of minutes through the number of sprinkles. Every hour, the number of bites on the donut increases, accordingly, through 24 hours. Additionally, the eyes blink every second! I wanted it to be playful and fun with a color palette as well. I also wanted it to have some sort of randomness incorporated within my project (which can be seen in the –limited– random colors of sprinkles).

Although this clock is not the easiest to read, I think that the creativity into this abstract clock makes the assignment really interesting. I had a difficult time figuring out what to make that can relate to the number of minutes, seconds, and hours. I also first drew the eyes but thought that there could be something more; this is the reason why the eyes blink every second! It was a very fun project to work on, especially because there was a wide range of opportunities to go about making the abstract clock.

Rough sketch of donut clock

Victoria Reiter – Project 06 – Abstract Clock

sketch

/*
Victoria Reiter
Section B
vreiter@andrew.cmu.edu
Project-06-Abstract Clocks
*/

function setup() {
    createCanvas(480, 260);
    // declares variables later used for time
    var h;
    var m;
    var s;
    // declares value for opacity
    var alphaValue;
}

function draw() {
    // describes appearance of text
    textFont('Colonna MT');
    textAlign(CENTER);

    // sets background color
    background(209, 252, 235);

    // variables for time
    h = hour();
    m = minute();
    s = second();

    // sizes for the images that will represent time aspects
    var hourShapeWidth = width / 36;
    var minuteShapeWidth = width / 200;
    var secondShapeWidth = width / 170;

    // makes a loop to count the hours, drawing forks, highlighting
    // the fork that represents the current hour
    for (var i = 0; i < 24; i++) {
        if (i !== h) {
            fill(25, 125, 75);
            fork(i * (hourShapeWidth + 6) + 7, 65);
        } else {
            fill(255, 255, 0);
            fork(i * (hourShapeWidth + 6) + 7, 65);
        }
    }

    // makes a loop to count the minutes, drawing dining glasses
    // and highlighting the glass that represents the current minute
    var glassX = k * (minuteShapeWidth + 5.5) + 6
    var glassY = height / 20;
    angle = 0;
    increment = 5;
    for (var k = 0; k < 60; k++) {
        if (k !== m) {
            fill(150, 150, 255);
            glass(k * (minuteShapeWidth + 5.5) + 6, 35);
        } else {
            fill(255, 255, 0);
            glass(k * (minuteShapeWidth + 5.5) + 6, 35);
        }
    }

    // makes a loop to count the seconds, drawing spoons and highlighting
    // the spoon that represents the current minute
    for (var j = 0; j < 60; j++) {
        if (j !== s) {
            fill(150, 155, 155);
            spoon(j * (secondShapeWidth + 5) + 5, 15);
        } else {
            fill(255, 255, 0);
            spoon(j * (secondShapeWidth + 5) + 5, 15);
        }
    }

    // lines that divide the clock into representative "time zones" for meals
    stroke(203, 158, 255, 150);
    line(width / 4 + 1, 0, width / 4 + 1, height);
    line(width / 2 - 3, 0, width / 2 - 3, height);
    line(3 * width / 4 - 7, 0, 3 * width / 4 - 7, height);

    // if the time is between midnight and 6am, it is breakfast time
    if (h >= 0 & h < 6) {
        noStroke();
        alphaValue = 255;
        fill(226, 140, 59, alphaValue);
        textSize(17);
        textStyle(BOLD);
        text("Breakfast Time!", 60, 230);
        scale(.5);
        breakfast(57, 255);
    } else {
        noStroke();
        alphaValue = 110;
        fill(226, 140, 59, alphaValue);
        textSize(17);
        textStyle(NORMAL);
        text("Breakfast Time!", 60, 230);
        scale(.5);
        breakfast(57, 255);
    }

    // if the time is between 6am and noon, it is lunch time
    if (h >= 6 & h < 12) {
            alphaValue = 255;
            fill(48, 155, 24, alphaValue);
            textSize(40);
            textStyle(BOLD);
            text("Lunch Time!", 357, 462);
            scale(1.2, 1.5);
            lunch(250, 180);
        } else {
            alphaValue = 110;
            fill(48, 155, 24, alphaValue);
            textSize(40);
            textStyle(NORMAL);
            text("Lunch Time!", 357, 462);
            scale(1.2, 1.5);
            lunch(250, 180);
        }

    // if the time is between noon and 6pm, it is dinner time
    if (h >= 12 & h < 18) {
            alphaValue = 255;
            fill(204, 89, 71, alphaValue);
            textStyle(BOLD);
            textSize(30);
            text("Dinner Time!", 495, 310);
            scale(.8);
            dinner(550, 225);
        } else {
            alphaValue = 110;
            fill(204, 89, 71, alphaValue);
            textSize(30);
            textStyle(NORMAL);
            text("Dinner Time!", 495, 310);
            scale(.8);
            dinner(550, 225);
    }

        // if the time is between 6pm and midnight, it is time for dessert !!
        if (h >= 18 & h < 24) {
            alphaValue = 255;
            fill(224, 0, 160, alphaValue);
            textStyle(BOLD);
            text("Time for Dessert!!!", 870, 387);
            scale(.575, .5);
            dessert(1500, 468);
        } else {
            alphaValue = 110;
            fill(224, 0, 160, alphaValue);
            textStyle(NORMAL);
            text("Time for Dessert!!!", 870, 387);
            scale(.575, .5);
            dessert(1500, 468);
        }
}

// draws a spoon
function spoon(x, y) {
    ellipse(x, y, 6, 8);
    rect(x - 1, y, 2, 12);
}

// draws a drinking glass
function glass(x, y) {
    arc(x, y, 8, 8, - 3 * PI / 16, PI + 3 * PI / 16, CHORD);
    rect(x - 1, y, 2, 10);
    rect(x - 2, y + 10, 5, 1);
}    

// draws a fork
function fork(x, y) {
    rect(x, y, 16, 5);
    rect(x, y - 10, 2, 10);
    rect(x + 5, y - 10, 2, 10);
    rect(x + 10, y - 10, 2, 10);
    rect(x + 14, y - 10, 2, 10);
    triangle(x, y + 5, x + 16, y + 5, x + 8, y + 10);
    rect(x + 6, y + 7, 4, 15);
}

// draws breakfast foods
function breakfast(x, y) {
    eggs(x, y);
    bacon(x + 75, y - 50);
}

// draws lunch foods
function lunch(x, y) {
    sandwich(x, y);
    apple(x + 95, y);
}

// draws dinner foods
function dinner(x, y) {
    mashedPotatoes(x + 80, y + 90);
    chicken(x, y);
}
 // draws dessert
 // function iceCream is put into this function just for ease of naming,
 // since "dessert" better represents the meal of this specific time zone
 // than does simply "ice cream"
function dessert (x, y) {
    iceCream(x, y);
}

// draws two sunny-side up eggs
function eggs(x, y) {
    noStroke();
    fill(255, 255, 255, alphaValue);
    ellipse(x, y, 100);
    ellipse(x + 20, y + 75, 100);
    fill(255, 155, 0, alphaValue);
    ellipse(x + 15, y, 35);
    ellipse(x + 45, y + 85, 35);
}

// draws two strips of bacon
function bacon(x, y) {
    fill(255, 50, 50, alphaValue);
    rect(x, y, 40, 180);
    rect(x + 60, y, 40, 180);
    fill(255, 150, 150, alphaValue);
    rect(x + 25, y, 8, 180);
    rect(x + 85, y, 8, 180);
}

// draws a sammich/sammie
function sandwich(x, y) {
    fill(165, 130, 41, alphaValue);
    ellipse(x - 5, y, 50);
    ellipse(x + 35, y, 50);
    rect(x - 20, y, 65, 75, 10);
    fill(0, 255, 0, alphaValue);
    quad(x - 25, y - 25, x + 15, y - 35, x + 20, y + 10, x - 10, y + 7);
    quad(x - 20, y, x - 33, y + 25, x + 5, y + 45, x + 5, y);
    quad(x - 20, y + 30, x - 14, y + 70, x + 20, y + 55, x + 10, y)
    fill(255, 255, 0, alphaValue);
    rect(x - 6, y - 22, 60, 95);
    fill(255, 0, 0, alphaValue);
    ellipse(x + 15, y + 15, 45, 85)
    fill(165, 130, 41, alphaValue);
    ellipse(x + 20, y - 5, 50);
    ellipse(x + 55, y - 5, 50);
    rect(x + 5, y - 5, 65, 75, 10);
}

// draws an apple
function apple(x, y) {
    fill(102, 79, 22, alphaValue);
    rect(x, y, 7, 20);
    fill(230, 0, 0, alphaValue);
    ellipse(x + 2, y + 55, 80, 70);
    fill(0, 195, 0, alphaValue);
    ellipse(x + 9, y + 17, 20, 6);
}

// draws a chicken drumstick
function chicken(x, y) {
    fill(255, alphaValue);
    rect(x - 10, y, 20, 125);
    ellipse(x - 17, y + 120, 30);
    ellipse(x + 13, y + 120, 30);
    fill(165, 130, 41, alphaValue);
    ellipse(x, y, 100, 125);
    triangle(x, y + 40, x - 20, y + 75, x + 20, y + 75);
}

// draws a nice scoop of mashed potatoes with a slab of butter
function mashedPotatoes(x, y) {
    fill(0, 0, 255, alphaValue);
    ellipse(x, y, 200, 15);
    fill(255, alphaValue);
    arc(x, y, 100, 100, PI, 0);
    fill(255, 255, 0, alphaValue);
    rect(x - 15, y - 52, 50, 30, 10);
}

// draws a yummy ice cream cone
function iceCream(x, y) {
    fill(25, 255, 255, alphaValue);
    ellipse(x, y + 50, 150);
    fill(255, 25, 235, alphaValue);
    ellipse(x, y - 50, 150);
    fill(191, 158, 74, alphaValue);
    triangle(x - 80, y + 80, x + 80, y + 80, x, y + 220);
    fill(245, 0, 0, alphaValue);
    ellipse(x + 15, y - 125, 35);
    fill(185, 0, 0, alphaValue);
    rect(x + 15, y - 150, 2, 20);
    fill(0, alphaValue);
    quad(x - 20, y - 30, x - 14, y - 38, x - 12, y - 9, x - 18, y - 25);
    quad(x - 40, y - 70, x - 34, y - 60, x - 30, y - 74, x - 28, y - 65);
    quad(x + 20, y - 50, x + 29, y - 60, x + 35, y - 44, x + 28, y - 55);
    quad(x + 60, y - 20, x + 54, y - 25, x + 57, y - 14, x + 65, y - 25);
    fill(132, 25, 255, alphaValue);
    ellipse(x - 15, y + 33, 10);
    ellipse(x - 55, y + 25, 15);
    ellipse(x - 25, y + 55, 8);
    ellipse(x + 40, y + 25, 10);
    ellipse(x + 25, y + 65, 12);
}

My clock for this week reflects my own biological clock…for when to eat meals! If it were truly accurately, every time of day would be “Time for Dessert!!!,” but for the sake of the project, I’ve also included breakfast, lunch, and dinner.

At the top are spoons to count the seconds, glasses for the minutes, and forks for the hours. The opacity of the meals also change, and are fully opaque when it is time to eat them!

Initial sketch of my idea (PS I got caught in the rain the other day so the pages are now all wet and crinkly)

I assigned foods that are typical to each meal [in the US anyway], like some nice bacon and eggs, a sandwich and apple, a chicken drumstick and mashed potatoes with butter, and ice cream. If I ever feel both hungry and confused I will turn to this clock for meal suggestions!

Mimi Jiao – Project 6 – Section E

sketch

/*
Mimi Jiao
wjiao@andrew.cmu.edu
Section E
Project-06
*/

function setup() {
    createCanvas(480, 480, WEBGL);
}

function draw() {
    var H = hour();
    var M = minute();
    var S = second();
    background(0, 0, 255);
    rotateZ(frameCount * .01);

    //in this for loop, as the seconds increase, 
    //the number of "fan" components within this shape increases
    for (var i = 0; i < S * 100; i++) {
        noStroke();
        fill(i * sin(i), i * cos(i), sin(i) * 200);
        beginShape();
        vertex(sin(i) * 1000, cos(i) * 1000, sin(i) * 1000);
        vertex(sin(i) * 1010, cos(i) * 1010, cos(i) * 1010);
        vertex(cos(i), sin(i), sin(i));
        endShape(CLOSE);
    }

    //size of sphere depends on the minute
    push();
    rotateX(frameCount * .005);
    rotateZ(frameCount * .01);
    for (var a = 0; a < M; a++) {
        noFill();
        strokeWeight(.4);
        //stroke color of sphere
        stroke(sin(radians(M)) * 255, sin(radians(M)) * 255, 
               sin(radians(M)) * 255);
        //Scales the size of the sphere for aesthetic purposes
        var mMap = map(M, 0, 60, 10, width);
        ellipsoid(mMap , mMap , mMap );
    }
    pop();

    push();
    //scales the hour by two for aesthetic purpose
    H *= 2;
    //rotates the shapes
    rotateX(frameCount * .05);
    rotateY(frameCount * .01);
    //loop drawing continuous geometric elements
    for (var p = 0; p < H * 50; p ++) {
        //constantly changes color of stroke based on time/sin
        stroke(200 + 25 * sin(millis() / 1000), 
             200 + 25 * sin(millis() / 1000 + HALF_PI),
             200 + 25 * sin(millis() / 1000 - HALF_PI));
        strokeWeight(.5);
        noFill();
        //changing origin so object moves across page
        translate(sin(H) * 24, sin(H) * 24, H);
        //coordinates for drawn geometric shape
        beginShape();
        vertex(p * cos(p) * .1, H * 10 * cos(p), .1 * (p - 1000));
        vertex(p* .01 * .1, p* 0.1 * .1, p*.01 * .1);
        vertex(p * sin(p) * .1, .1 * p * cos(p), 10 * H);
        vertex(p * cos(p + PI) * .1, H * 10 * cos(p + PI), .1 * (p - 1000));
        vertex(p * sin(p + PI) * .1, .1 * p * cos(p + PI), .1 * H);
        endShape(CLOSE);
    }
    pop();
}


I’ve always wanted to play around with WEBGL and seeing Jenny Hu’s clock project pushed me to use it for this assignment. I started out checking out primitive 3D functions like translate, ellipsoid and box to get a better understanding of how it works. I also wanted to explore how to make optical art, so I checked out different math functions in for loops. I played around with trig functions to see how shapes would be affected and also messed around with incorporating the mouseX function into for loops to alter the shape of the shapes I made. After experimenting, I went back into incorporating the ellipsoid to represent time because it was most fitting for my skill level. I initially wanted to do something more complex but I couldn’t quite figure out how to create it using vertex points.

My approach to the abstract clock isn’t very visually intuitive but I wanted to explore mapping time using different math functions in WEBGL.