rbd test

rbdtest

var sun = 220;
var moon = 235;
var cloud = 260;

var s;
var m;
var h;

function setup() {
    createCanvas(480, 480);
    frameRate(1);  
    s = second();
    m = minute();
    h = hour();
}

function draw() {
    background(0);
    noFill();
  
    if (s % 2 === 0) {
    if (h >= 8 & h < 13) {
      background(182, 224, 239);
      // base()
      // morning()
    } else if (h >= 13 & h < 17) {
      background(141, 194, 214);
      // base()
      // afternoon()
    } else if (h >= 17 & h < 22) {
      background(79, 130, 150);
      // base()
      // twilight()
    } else if (h >= 22 & h < 23.5) {
      background(34, 79, 96);
      // base()
      // night();
    }
    } else if (h >= 0 & h < 8) {
      base()
    }
  
    //minutes
    for (var j = 0; j < minute(); j ++){
      sun = map(j, 0, 70, 220, 255);
      moon = map(j, 0, 60, 125, 255);
      cloud = map(j, 0, 50, 280, 255);
      stroke(sun, moon, cloud);
      fill(37, 179, 255);
      ellipse(240, 240, 9*j, 9*j);
    } 
     push();
  
    //seconds
     noFill();
     translate(width/2, height/2);
    for (var i = 0; i < second(); i ++) {
      sun = map(i, 0, 70, 210, 71);
      moon = map(i, 0, 60, 345, 204);
      cloud = map(i, 0, 50, 0, 234);
      stroke(sun, moon, cloud);
      stroke(50, 75, 255);
      rotate(radians(3));
      ellipse(0, 0, 30, 450);
    } 
    
      pop();
  
      
    {
      
    } 
   
     strokeWeight(2);
     noFill();
     translate(width/2, height/2);
    //hours
    for (var k = 0; k < hour(); k ++){
      sun = map(k, 0, 70, 255, 255);
      moon = map(k, 0, 60, 255, 255);
      cloud = map(k, 0, 60, 102, 255);
      stroke(sun, moon, cloud, 190);
      rotate(radians(8));
      ellipse(0, 0, 150, 400);
      
        
    }		
    
}

Leave a Reply