xxxxxxxxxx
164
let dayInYear;
let minuteInHour;
let minuteAccurate,hourPercent;
let mappedX=0;
let curHour,nextHour;
let leftBound, rightBound;
let decadeSeconds, percentOfDecade;
let decadeTextX;
let yearsLeft;
let monthsLeft;
let hoursLeft;
let daysLeft;
let minutesLeft;
let secondsLeft;
//let secondsInDecade = 31536000*10;
let secondsInDecade = 315400000;
let randPos = [];
let forHourMapped;
function setup() {
createCanvas(windowWidth, windowHeight);
randomSeed(123);
for(let i=0; i <5000; i++){
randPos.push(createVector(random(width),random(height)));
}
textSize(18);
dayInYear = (month()-1)*(365/12) + day();
print(dayInYear);
noStroke();
rectMode(CENTER);
leftBound = width/8;
rightBound = width-(width/8);
colorMode(HSB,1);
}
function draw() {
background(hourPercent/100,.40,.85);
//background(map(minuteAccurate,0,60,0,250));
minuteAccurate = (minute() + (second())/60);
mappedX = map(minuteAccurate,0,60,leftBound,rightBound);
fill(30);
ellipse(mappedX,height/2,15,15);
hourPercent = nfc(map(minuteAccurate*100,0,60,0,1),0)
text(hourPercent+"%",mappedX-5,height/2
+27);
//something about the new decade
//2020 decade clock
//maybe equal space shown from 2010, and 2030
//mappedX = map(second(),0,60,0,width);
//maybe a very slow drum roll with triggered sounds that speed up over a decade
//maybe something moving from left to right, a finger pushing a button something like that
//maybe displays how many seconds left in the decade
text(hour()+":00" ,leftBound,height/2 - 30);
text("|" ,width/8,height/2 );
text(hour()+1 +":00" ,rightBound,height/2 - 30);
text("|",width-width/8,height/2);
yearsLeft = (2030-year())-1;
monthsLeft = (12-month());
hoursLeft = (24-hour());
daysLeft = ((365/12)-day());
minutesLeft = (60-minute());
secondsLeft = (60-second());
// print(yearsLeft);
// print(monthsLeft);
// print(daysLeft);
// print(hoursLeft);
// print(minutesLeft);
// print(secondsLeft);
decadeSeconds = second() + minute()*60 + hour()*60*60 + (day()-1)*60*60*24 + (month() *2628000) + (((year()-2020)) * 31540000);
//decadeSeconds = secondsLeft + (minutesLeft * 60) + (hoursLeft*60*60) + (daysLeft * 60*60*24) + (monthsLeft * (365/12) * 24 *60 *60) + (yearsLeft * 12 * (365/12) * 24 *60 *60);
percentOfDecade =nfc((decadeSeconds/secondsInDecade)*100,6);
decadeTextX = map(percentOfDecade,0,100,leftBound,rightBound);
text(percentOfDecade + " %",decadeTextX,height*.6+60);
ellipse(decadeTextX,height*.6+40,7,7,);
text("2020",leftBound,height* .6 + 20);
text("|" ,leftBound,height*.6 + 45 );
text("2030",rightBound,height*.6 + 20);
text("|" ,rightBound,height*.6 + 45 );
//map to an array of words that create sentences change over time
//.0038 should be for percentage of decade
forHourMapped = map(hourPercent,0,100,1,10);
// for(let i=0; i<forHourMapped; i++){
// fill(0);
// ellipse(randPos[i].x,randPos[i].y,10,10)
// }
}