Danny-Cho-Project-06-Abstract-Clock

Abstract Clock

var x = [0];
var y = [0];
var Xoffset = 0;
var Yoffset = 0;
var col = 255;
var resetclr = 0;
var sc = [0];
var gRate = 0; //gradient speed
var activity = 0;


function setup() {
  createCanvas(480, 480);
  background(0);
  frameRate(30);
  var H = hour();
  var M = minute();
  var S = second();
}

function neuron() {
  col = random(0, 255);

stroke(col, 80)
  beginShape()
  for (i = 0; i < x.length; i++){
    vertex(x[i], y[i]);
  }
  endShape()
  Xoffset = random(-10, 20);
  Yoffset = random(-10, 20);
  x.push(x[x.length-1]+Xoffset);
  y.push(y[y.length-1]+Yoffset);
  if (i % 60 == 0) {
    x[i] = 0;
    y[i] = 0;
    background(0)
    endShape()
    beginShape()
  }
  if (second() % 5 == 0) {
    fill(0, 0, 0, resetclr);
    noStroke();
    rect(-50,-50, width + 50, height + 50);
    x = [0];
    y = [0];
    resetclr ++;
  }
  
}
//function to determine the breathing rate
function activeness(){
  //fast breathing during the active hours of the day
  if (hour() > 6 & hour() < 23) {
  activity = 2;
}
  //slow breathing due to sleep
  if (hour() < 6 || hour() > 23) {
    activity = 0.3
  }
  //medium speed breathing when waking up and going to bed
  if (hour() == 6 & hour() == 23) {
  activity = 1;
}
}

//changing the gradient to represent breathing
function breathing(){
  var c = map(sin(radians(gRate)), -1, 1, 0, 255);
  for (j = 0; j < 255; j++) {
      stroke(abs(j - abs(sin(radians(gRate))) * 255));

      circle(width / 2, height / 2, j);
      print(c);
    }
}

function draw(){
noFill();
//the
for (rota = 0; rota < 4; rota ++) {
  push()
  translate(width / 2, height / 2);
  rotate(PI / 2 * (rota + 1))
  neuron()
  pop()
}

if (second() % 6 == 0) {resetclr = 0;}
activeness();
breathing();


gRate = gRate + activity;
}

I made a biological clock trying to describe two phenomenons that happen within our bodies constantly: breathing and information exchange between neurons. The gradient circle in the middle represents breathing and the electricity-looking lines represent the signals being transferred between the neurons.

The breathing speed changes depending on the hour of the day. I took into account how a person’s activeness affects their breathing. When the person is asleep, 12am – 5am, breathing is the slowest, medium speed at 6am and 11am, when people state of activeness is transitioning, and fastest from 7am to 10pm, which are the active hours for me.

Leave a Reply