eeryan-project06-abstract clock

sketch

//erin ryan
//lab c
//eeryan@andrew.cmu.edu
//project 06 variable face

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

function draw() {//this is a 24 hour clock
  background(0);
  var h = hour();
  var m = minute();
  var s = second();
  for(var x = 0; x < width; x += 30){
    for(var y = 0; y < height; y += 30){
      fill(40,35,249);
      noStroke();
      ellipse(x, height/2, 2, 2);
      ellipse(width/2,y,2,2);
      }
    }
  stroke(255,255,0);
  noFill();
  ellipse(width/2,height/2, 300, 300);
//second indicator
  push();
  translate(width/2, height/2);
  rotate(s*6);
  stroke(255,248,220);
  strokeWeight(2);
  noFill();
  arc(150,150,25,25,180,0,CHORD);
  pop();
//minute indicator
  push();
  translate(width/4, height/4);
  rotate(m*6);
  stroke(205,92,92);
  strokeWeight(4);
  noFill();
  ellipse(0,0,60,60);
  pop();
//hour indicator
  push();
  translate(width/2, height/2);
  rotate(h*30);
  stroke(220,20,60);
  strokeWeight(5);
  noFill();
  line(0,10,0,50);
  pop();
}

I started off by looking at a lot of the clocks by Vincent Toupe. I ended up using three different shapes to represent the hour, minute, and second hands. It’s a 24 hour clock. I tried to find a color palette that worked with the simple, graphic elements of the piece.

Leave a Reply