Project 06 Abstract Clock

sketch

var c; //color
var hourcolor; //color of the hour flower
var mincolor; //color of the minute flower
var seccolor; //color of the second flower
var wintercolor = '#ffffff'; //color of the winter ground
var springcolor = '#c6ed4c'; //color of the spring ground
var summercolor = '#29d359'; //color of the summer ground
var fallcolor = '#f26f16'; //color fo the fall ground

function setup() {
    createCanvas(480, 480);
    hourcolor = color(255,72,72,200); //red
    mincolor = color(255,46,131,200); //pink
    seccolor = color(123,52,214,200); //purple

}

function draw() {
  background('#5e99ef'); //blue sky
  push();
  flower(110,320-10*hour(),hourcolor); //hour flower 
  pop();
  push();
  flower(230,320-4*minute(),mincolor); //minute flower
  pop();
  push();
  flower(350,320-4*second(),seccolor); //second flower
  pop();
  
  noStroke();
  if (month() > 2 & month() <= 5) { //when it is spring--March, April, May 
    fill(springcolor);
    rect(0,width-70,width,70);
  } else if (month() > 5 & month() <= 8  ) { //when it is summer--June, July, August
    fill(summercolor);
    rect(0,width-70,width,70);
  } else if (month() > 8 & month() <= 11) { //when it is fall--September, October, November
    fill(fallcolor);
    rect(0,width-70,width,70);
  } else { //when it is winter--December, January, February
    fill(wintercolor);
    rect(0,width-70,width,70);
  }
}

function flower(x,y,c) { //flower structure
  translate(x,y);
  noStroke();
  fill('#86e55a'); //green
  rect(-2,0,5,500); //flower stem
  ellipse(-10,100,20,10); //stem leaf
  ellipse(10,150,20,10); //stem leaf
  ellipse(-10,200,20,10); //stem leaf
  ellipse(10,250,20,10); //stem leaf
  fill(c);
  for (var i = 0; i < 5; i ++) { //flower petals
    ellipse(0, 0, 20, 70);
    rotate(PI/5);
  }
  fill('#ffd961'); //yellow
  ellipse(0,0,30,30); //flower middle circle
}

Leave a Reply