Code

// clock
// Herbert Spencer
// drag your axiety to the future

float variance = 0;
int prevSec;
int millisRolloverTime;
int S = second();

void setup(){
  size(300,300);
  smooth();
  rectMode(CORNER);
  cursor(HAND);
  millisRolloverTime = 0;
}


void draw(){
  background(#333333);

  if (prevSec != S){
    millisRolloverTime = millis();
  }

  prevSec = S;

  float realHour = hour() + (minute()/60.0);
  float realMinute = minute() + (second()/60.0);
  float realSecond = S + ((millis())/1000.0);
  int realMillis = millis() - millisRolloverTime;

  float myMillis = realMillis/100;
  float mySecond = realSecond + variance;
  float myMinute = realMinute + (variance/60);
  float myHour = realHour + (variance/3600);

  drawclock(myHour,myMinute,mySecond);

  // time accelerator  
  if (mousePressed == true) {
    int xdim = abs(mouseX - pmouseX);
    int ydim = abs(mouseY - pmouseY);
    variance += (xdim+ydim)/10;
    background(255,mouseX/2,mouseY/2);
    drawclock(myHour,myMinute,mySecond);
  }

  // time accelerator  
  if(keyPressed){
    if (key == 'A' || key == 'a') {
      int xdim = abs(mouseX - pmouseX);
      int ydim = abs(mouseY - pmouseY);
      variance -= (xdim+ydim)/10;
      background(mouseX/2,mouseY/2,255);
      drawclock(myHour,myMinute,mySecond);
    }
  }
}


void drawclock(float hora, float minu, float seg){
  stroke(255);
  pushMatrix();
  {
    //draw the clock in the middle
    translate(width/2,height/2);

    //the big circle
    fill(200);
    stroke(0);
    strokeWeight(10);
    ellipse(0,0,200,200);
    noStroke();


    //the marks
    pushMatrix();
    strokeWeight(0.5);
    noFill();
    {
      for(int i=0; i<200; i+=10){
        stroke(20,30);
        ellipse(0,0 ,i,i);
      }
    }
    noStroke();
    popMatrix();

    //second
    pushMatrix();
    {
      fill(255);
      ellipse(0,0,17,17);
      fill(200,0,0);
      rotate(radians(-90+seg*6));
      triangle(-3,-3.5, -3,3.5, 90,0);//secundero, the long and fast one
    } 
    popMatrix();

    pushMatrix();
    {
      fill(0);
      strokeWeight(1);
      rotate(radians(-90+minu*6));
      rect(-1,-1.5, 84, 3);//minutero, the medium one
    } 
    popMatrix();

    pushMatrix();
    {
      rotate(radians(-90+hora*30));//the magical rotation
      fill(0);
      rect(-2,-3, 60, 6); //horario, the short one
      ellipse(0,0,13,13);
      noFill();
      stroke(150);
      ellipse(0,0, 8,8);
    } 
    popMatrix();
  } 
  popMatrix();
}

021 -- Clock: A Diurnally Cyclic Display (Due Monday 10/2)

Statement:The day is a core biological cycle which affects nearly all life on earth. Whether or not we care to know the exact "time", we always maintain an inner sense of the day's progression, which we perceive through environmental changes in sunlight, sound (traffic in the morning, crickets at night), temperature and smell (think of cool summer evenings). Divisions of the day into units of 12 and 60, while useful, are arbitrary conventions we have inherited from ancient Mesopotamian astronomers.

Create a "clock" (-- for lack of a better word; more accurately, a diurnally-cyclic display ) which reflects your own intuitions about the structure of a "day". You may incorporate conventional mathematical divisions (and notations) of time, or invent and impose your own. In planning your design, consider whether your clock is a self-standing representation of your own inner experience, or a digital artifact with a permeable membrane to external information (e.g. user interaction, live Internet data, etc.).

It is your choice as to whether the time of day can be literally readable from your clock. Nevertheless, your clock should appear different at all times of the day, and it should repeat its appearance every 24 hours. (You can make a 12-hour clock if you prefer). Try to devise a novel graphic concept, e.g. not just a clock face with numbers! Feel free to experiment with any of the graphical tools at your disposal, including color, shape, etc. Reactivity to the cursor is optional.

In the past, I have prohibited the use of Arabic or Roman Numerals in this assignment, in an attempt to encourage the creation of novel abstract representations. This restriction has been lifted, but if your representation uses literal numbers, it should be with good reason. Don't forget to SKETCH FIRST!
a regular clock, to start

hide statement