Project 06: Abstract Clock

sketch
//Anthony Pan
//Section C

var d = 0; //diameter for 24 hr circles
var d1 = 0; //diameter for 24 hr circles
//var d2; //first circle diameter
//var d3; //first cirlce diameter

var c1 = []; //color array for the 24 hrs of a day
var hours = []; //hours in a day

function setup() {
    createCanvas(480, 480);
    for(var i = 0; i <= 23; i++) {
        hours[i] = i;

        if(i >= 0 & i <= 8){
            c1[i] = color(0, random(256), random(256)); //random green + blue, no red first 8 hrs
        }

        if(i > 8 & i <= 16) {
            c1[i] = color(random(256), 0 , random(256)); //random red + blue, no green between 8-16 hrs

        }

        if(i >16 & i<=23) {
            c1[i] = color(random(256), random(256), 0); //random red + green, no blue 16-24 hrs 

        }

    }

}



function draw() {
    background(0);
    draw_circle(d, d1);
    //fill_circle(d2, d3);

    noStroke();
    fill(c1[hour()]); //fill color based on the hour

    //draw a circle that grows based on the number of minutes that has passed
    ellipse(240, 240, 20*hour() + minute()/3, 20*hour() + minute()/3); 

    //display clock
    textSize(15);
    strokeWeight(1);
    fill(255);
    text(hour() + ":" + minute() + ":" + second(), 10, 470); //display time on 24 hr clock at bottom left corner
   
}

function draw_circle(d, d1){
    for(var i = 1; i <= 25; i++) {
        noFill();
        stroke(255); //create why circle stroke
        ellipse(240, 240, d, d1); //create 24 concentric cirlces for 24 hrs in a day
        d += 20; 
        d1 += 20; //d and d1 grow each cirlce's radius

    }

}


//process for creating fill circle
/*
function fill_circle(d2, d3) { //fill circle based on minute
    for(var i = 0; i <= hour(); i++) {
        noStroke();
        fill(c1[hour()]); //fill color based on the hour
        ellipse(240, 240, 10*hour() + d2*minute(), 10*hour() + d3*minute());

        d2 += 1/6; //rate of growth based on time /proportions
        d3 += 1/6;
        print(d2);
    }
}
*/

/*
function fill_circle(d2, d3) { //fill circle based on minute
    noStroke();
    fill(c1[hour()]); //fill color based on the hour
    ellipse(240, 240, 20*hour() + minute()/3, 20*hour() + minute()/3);
    
}

/*
function draw_circle(d, d1){
    for(var i = 0; i <= 23; i++) {
        noFill();
        stroke(255);
        ellipse(240, 240, d, d1); //create 24 concentric cirlces for 24 hrs in a day
        d += 20;
        d1 += 20; //d and d1 grow each cirlce's radius

    }


}
*/

/*
function fill_circle(d2, d3) { //fill circle based on minute
    for(var i = 0; i <= minute(); i++) {
        noStroke();
        fill(c1[hour()]); //fill color based on the hour
        ellipse(240, 240, d2, d3);
        d2 += 0.33; //rate of growth based on time /proportions
        d3 += 0.33;

    }

}
*/

Project Description:

This clock has 24 concentric circles representing the 24 hours in a day. A second function creates a circle that is filled with a random color based on the range of time: 0-8, 8-16, and 16-24. The circle fills the concentric circles slowly, growing based on each minute passed. There is a display of the time on a 24-hour clock at the bottom of the canvas to show the exact time as the circle fills the concentric circles very slowly.

Process/Ideation:

This was some of my process working on creating this clock.

Project-06-Abstract-Clock

sketch

function setup() {
    createCanvas(400, 400);
    angleMode(DEGREES);
}

function draw() {
    background(240, 217, 156);

    fill(220);

    strokeWeight(2);
    ellipse(200,200,395);


    fill('magenta');
    stroke(150,255,100);
    ellipse(200,180,50);

    fill(183, 156, 240);
    strokeWeight(6);
    arc(200,250,200,150,0,180,CHORD);


    let hr = hour();
    let mn = minute();
    let sc = second();

    strokeWeight(4);
    stroke(255,100,150);
    noFill();
    let end1 = map(sc,0,60,0,360);
    arc(120,120,35,35,0,end1);
    arc(280,120,35,35,0,end1);

    stroke(150,100,255);
    let end2 = map(mn,0,60,0,360);
    arc(120,120,28,28,0,end2);
    arc(280,120,28,28,0,end2);

    stroke(150,255,100);
    let end3 = map(hr % 12,0,12,0,360);
    arc(120,120,20,20,0,end3);
    arc(280,120,20,20,0,end3);


    stroke("orange");
    let s = map(second(),0,60,0,360) - 180;
    line(200,180,200 + cos(s)*50, 180 + sin(s)*50);

    strokeWeight(2);
    text('hehe: \n' + s, 100, 190);
    text('hehe: \n' + s, 300, 190);


    strokeWeight(1);
    stroke('red');
    text('Hey_time: \n' + hr + 'hours' + mn + 'minutes', 100, 50);



}

function mouseIsPressed() {
    if (s % 5 == 0){
    fill('blue');
    strokeWeight(6);
    stroke(0);
    arc(200,250,200,150,0,180,CHORD);
    } else {
        fill(183, 156, 240);
        strokeWeight(6);
        stroke(0);
        arc(200,250,200,150,0,180,CHORD);
    }
}



This project was quite challenging. I had to search through the internet to learn how to call the numbers using javascript. It turned out to be easy. However, contextualizing my concepts to code was again very difficult. I tried to create a cute face using functions that implement the numbers of the clock. However, as always, it turned out quite differently than my sketch. I used lines on the nose and used the print function to print the time on the top left corner of the canvas.

Project 6 Abstract Clock

It was alot of fun making this peice. It was really hard to figure out where to start, but when I decided to split the hour, minute, and second into different parts, I was able to better figure out what to do.

sketch

var lengt = 10;
var hr;
var min;
var sec;


function setup() {
    createCanvas(480, 480, WEBGL);
    hr = hour();
    min = minute();
    sec = second();
    text("p5.js vers 0.9.0 test.", 10, 15);
    ellipse(240,240,480);
}


// drawing a plant that grows and dies at 24 hours but then grows from the stump again

function draw() {
  background(220);
  sec = second();
  min = minute();
  sec = second();
  thePlant(hr);
  theSky(min,hr);
  theLeaves(sec);
}

function theLeaves(second){ //the leaves or flower changes based on the second
  fill("purple");
  cone(10+second,65,16,3);
}

function thePlant (hr){ //each hour adds length to the plant
  fill("brown");
  translate(0,100);
  cylinder(60, 100, 16, 16);
  
  //the actual plant
  translate(0,-70);
  fill("green");
  cylinder(20, lengt*hr, 16, 16);
}

function theSky (min,hr){ //changes based on the 12 hr system
  if (hr <= 12){
    fill(0,0,0.3472*(min + (60*hr)));
    }else{
      fill(0,0,255 - 0.3472*(min + (60*hr)));
    }
  rect(-480,-480,960,960);
}

Random Time

I must say this design happened a bit by accident. I was trying to make it so that based on my clock motions, particularly of the dot that represents the second hand, that I would have moving dots around it that would change position using noise. During this process because of how I was doing my rotations using frameCount, I ended up creating this instead. I liked it so much on the second hand I used it for my hour and minute to create the moving circles. They move very fast but sometimes it will show down and the hour and minute circles will intersect and I think it is very beautiful.

thought process before accident

sketchfile

//Georgia Miller
//15-104
//section d

var w; 
var seconds; 
var minutes;
var hours;

function setup() {
    createCanvas(480, 480);
    background(220);
    var radius = min(width, height) / 2;
    seconds = radius * 0.71; //radius measurements for circle shape
    minutes = radius * 0.5;
    hours = radius * 0.5;
    w = width / 2;
}


function draw() {
    background(255);
    var s = map(second(), 0, 60, 0, TWO_PI) - HALF_PI; //for second
    var m = map(minute() + norm(second(), 0, 60), 0, 60, 0, TWO_PI) - HALF_PI; //for minute
    var h = map(hour() + norm(minute(), 0, 60), 0, 24, 0, TWO_PI * 2) - HALF_PI; //for hour
    push();
for(var elhour = 0; elhour < 50; elhour++){ //create circles around hour circle
        //frameRate(30);
        translate(w + cos(h) * hours, w + sin(h) * hours);
        rotate(frameCount/1000);
        stroke(0)
        fill(120, 0, 120);
        ellipse(35, 0, 30, 30);
        fill(140, 0, 140);
        ellipse(0, 35, 30, 30);
        fill(160, 0, 160);
        ellipse(35, 35, 30, 30)
        fill(160, 0, 160);
        ellipse(-35, -35, 30, 30);
        fill(180, 0, 180);
        ellipse(0, -35, 30, 30);
        fill(200, 0, 200);
        ellipse(-35, 0, 30, 30);
        fill(220, 0, 220);
        ellipse(35, -35, 30, 30);
        fill(240, 0, 240);
        ellipse(-35, 35, 30, 30);
}
pop();
push();
    for(var elmin = 0; elmin < 50; elmin++){ //create circles around minute circle
        translate(w + cos(m) * minutes, w + sin(m) * minutes);
        rotate(frameCount/800);
        stroke(0)
        fill(150, 75, 0);
        ellipse(25, 0, 20, 20);
        fill(200, 100, 0);
        ellipse(0, 25, 20, 20);
        fill(250, 130, 0);
        ellipse(25, 25, 20, 20)
        fill(255, 150, 50);
        ellipse(-25, -25, 20, 20);
        fill(150, 75, 0);
        ellipse(0, -25, 20, 20);
        fill(200, 100, 0);
        ellipse(-25, 0, 20, 20);
        fill(255, 130, 0);
        ellipse(25, -25, 20, 20);
        fill(255, 150, 50);
        ellipse(-25, 25, 20, 20);
}
pop();
    push();
    for(var elsec = 0; elsec < 50; elsec++){ //create circles around second circle
        translate(w + cos(s) * seconds, w + sin(s) * seconds);
        rotate(frameCount/500);
        stroke(0)
        fill(100, 0, 0);
        ellipse(15, 0, 10, 10);
        fill(120, 0, 0);
        ellipse(0, 15, 10, 10);
        fill(140, 0, 0);
        ellipse(15, 15, 10, 10)
        fill(160, 0, 0);
        ellipse(-15, -15, 10, 10);
        fill(180, 0, 0);
        ellipse(0, -15, 10, 10);
        fill(200, 0, 0);
        ellipse(-15, 0, 10, 10);
        fill(220, 0, 0);
        ellipse(15, -15, 10, 10);
        fill(240, 0, 0);
        ellipse(-15, 15, 10, 10);
    }
    pop();
     stroke(0);
    fill(255);
    ellipse(w + cos(s) * seconds, w + sin(s) * seconds, 10, 10); //second circle
    ellipse(w + cos(m) * minutes, w + sin(m) * minutes, 20, 20); //minute circle
    ellipse(w + cos(h) * hours, w + sin(h) * hours, 30, 30); //hour circle
}

">

Project 06: Abstract Clock

sketch

//Alana Wu
//ID: alanawu
//Project 06 Abstract Clock


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

function draw()
{
//color of background changes by minute
    fill (minute()*5, minute()*3 + 100, 255 - minute());
    rect (0, 0, 400, 400);

//how many curves are drawn depends on hour
    if (hour() > 0)
    {
        anenome (100, 240, 240, 10, 65);
    }
    if (hour() > 1)
    {
        anenome (200, 255, 230, 35, 53)
    }
    if (hour() > 2)
    {
        anenome (200, 0, 200, 17, 35);
    }
    if (hour() > 3)
    {
        anenome (255, 200, 230, 25, 5);
    }
    if (hour() > 4)
    {
        anenome (255, 100, 170, 30, 75);
    }
    if (hour() > 5)
    {
        anenome (100, 240, 240, 10, 65);
    }
    if (hour() > 6)
    {
        anenome (255, 255, 200, 15, 25);
    }
    if (hour() > 7)
    {
        anenome (200, 220, 50, 25, 40);
    }
    if (hour() > 8)
    {
        anenome (150, 100, 255, 10, 85);
    }
    if (hour() > 9)
    {
        anenome (0, 200, 255, 24, 30);
    }
    if (hour() > 10)
    {
        anenome (200, 180, 255, 8, 30);
    }
    if (hour() > 11)
    {
        anenome (255, 50, 50, 28, 92);
    }

//draws 3 octopi, each of which display, hour, minute, or second
    octopus(mouseX, mouseY - 25, minute());
    octopus(mouseX + 30, mouseY + 25, second());
    octopus(mouseX - 30, mouseY + 25, hour());

//while within the canvas, waves move down each second
    waveRows(constrain (second()*25 + 50, 0, height+20));

}

//grid of waves
function waveRows (start)
{
    red = 10;
    green = 100;
    blue = 255;
    for (var h = start; h < height + 60; h +=50)
    {
        row3(h);
        row4(h);
    }
}

//horizontal row of 3 waves
function row3 (y)
{
    for (var x = 85; x <= width; x += 125)
    {   
        for (var i = 5; i > 0; i--)
        {
        strokeWeight (1);
        fill (red, green, blue);
        ellipse (x, y - 25, i*20, i*20);
        red += 30;
        green += 30;
        }

        red = 10;
        green = 100;
    }
}

//horizontal row of 4 waves
function row4 (y)
{
    for (var x = 25; x <= width; x += 125)
    {   
        for (var i = 5; i > 0; i--)
        {
        strokeWeight (1);
        fill (red, green, blue);
        ellipse (x, y, i*20, i*20);
        red += 30;
        green += 30;
        }

    red = 10;
    green = 100;
    }
}

//draws colorful wavy curve
function anenome (red, green, blue, length, tilt)
{   
    push();
    translate (10, 350);
    frameRate (6);
    rotate (radians (-tilt));
    for (var n = 0; n < 10; n++)
    {
        for (var x = 0; x < length; x += .1)
        {
            noStroke();
            fill (red, green, blue);
            circle (x*20 + random (0,15), -25*cos(x) + random (0, 15), 13-x);  

        }
    }
    pop ();
}

//draws octopus w/ a color that changes by the minute
function octopus (x, y, time)
{
    noStroke();
    fill (minute()*10, 255 - minute(), 250);
    ellipse (x, y, 50, 40);
    for (var i = 0; i < 5; i++)
    {
        push();
        translate (x, y);
        rotate (radians (i*15 - 29));
        ellipse (15 - i*6.8, 22, 10, 20);
        pop();
    }
    fill (0);
    ellipse (x - 12, y + 2, 8, 8);
    ellipse (x + 12, y + 2, 8, 8);
    noFill();
    stroke(0);
    arc (x, y+7, 8, 8, 0, PI, OPEN);
    strokeWeight (1);
    textSize (10);
    text (time, x - 14, y - 6);

}

In this project, the abstract waves change by second, the three octopi reflect the time, the number of colorful curves (I was originally thinking anemone, but it really didn’t translate and I liked these anyways) change by the hour, and the colors of the background and the octopi change as the time changes.

Abstract Clock

You can tell the time and date with this abstract clock. From inside out each hexagon tells seconds, minutes, hours, days, months, respectively. The red line indicates the start of a category. An interesting thing about using hexagons is that it is easy to use to approximate what time it is since it has 6 sides, and units of time are easily divided by 6.

project-06-clock
//Luke Mattson
//section A
var today = new Date();
var now = [today.getSeconds(), today.getMinutes()+(today.getSeconds()/60), today.getHours()+(today.getMinutes()/60),today.getDate()+(today.getHours()/24),today.getMonth()+(today.getDate()/30)] 
var highest = [60, 60, 24, 30, 12] 
var angle = []
var rate = [360/60, 360/60/60, 360/60/60/24, 360/60/60/24/30,360/60/60/24/30/12]
var size = [47,94,141,188,235]

function setup(){
    frameRate(1)
	createCanvas(480, 480);
    angleMode(DEGREES)

    for (i=0; i<=6; i++) {          
        angle[i] = (now[i]/highest[i])*360
    }
    
}


function draw(){
    background(255,179,71)
    fill(255,0,0)
    rect(240,239,240,2)
    translate(240,240)
    for (i=0; i<=4; i++) {
        push()
        rotate(angle[i])
        angle[i] += rate[i]
        hexagon(size[i])
        pop()
    }
    print(rate)
}

function hexagon(s){
    noFill()
    beginShape()
    vertex(s,0)
    vertex(s/2,s*sqrt(3)/2)
    vertex(-s/2,s*sqrt(3)/2)
    vertex(-s,0)
    vertex(-s/2,-s*sqrt(3)/2)
    vertex(s/2,-s*sqrt(3)/2)
    endShape(CLOSE)
    fill(130,200,200)
    ellipse(s,0,s/5)
}