xxxxxxxxxx
124
var eno;
var archicon;
var blank;
var ding;
var counter = 0;
var timeleft = 900;
function preload(){
archicon = loadImage('icons/arch' + int(random(1,1001))+ '.jpg');
blank = loadImage('blank.jpg');
ding = loadSound('ding.mp3');
}
function convertSeconds(s) {
var min = floor(s/60);
var sec = s % 60;
return nf(min, 2) + ':' + nf(sec, 2);
}
function setup(){
createCanvas(windowWidth, windowHeight);
background(255);
var furniture = ["studio equipment", "desk", "wagon", "wheelbarrow", "utility cart" , "pedestal" , "music stand" , "bookshelf" , "wall shelf" , "speed dating table" , "bed frame", "coffee table", "dresser", "workbench", "cubicle desk", "nightstand", "speaker cabinet", "personal shelter", "hanging light", "free-standing light", "public locker", "public bench", "trophy case", "kitchen island", "desert island survival prop", "game table", "dining chair", "checkout register", "portable podium", "birdhouse"];
var index = 0
index = int(random(0, furniture.length));
if (index == furniture.length) {
index = 0;}
textAlign(CENTER);
textSize(height/35);
fill(55);
textFont('Helvetica');
text(furniture[index], width/4, height/4);
var randomeno = random(eno);
textAlign(CENTER);
rectMode(CENTER);
textSize(height/50);
textFont('Helvetica');
fill(50);
text(randomeno, width/4, height*0.8 ,width/3,height/4);
imageMode(CENTER);
image(archicon, width/4, height/2);
let inputElem= createInput('');
inputElem.input(onInput);
inputElem.position((width*0.75)-100, height*0.73, 200, 75);
function onInput(){
// clear();
fill(255);
noStroke();
rect((width*0.75), (height/2), (width/3), (height*0.6))
fill(0);
textAlign(CENTER);
textSize(height/60);
text(this.value(), (width*0.75), (height/2), (width/3), (height*0.6));
}
var timer = select('#timer');
timer.html(convertSeconds (timeleft-counter));
timer.style('font-size', '50px');
timer.style('text-align', 'CENTER');
timer.position(width*0.72, 10);
var interval = setInterval(timeIt, 1000);
function timeIt() {
counter++
timer.html(convertSeconds(timeleft-counter));
// timer.style('font-size', '50px');
// timer.position(width/4, height/5);
if (counter == timeleft){
ding.play();
clearInterval(interval);
print();
counter = 0
}}
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
function draw(){
clock();
// onInput();
}
function clock(){
imageMode(CENTER);
image(blank, width/4, height/10, width/2, height/5);
let d1 = month();
let d2 = day();
let d3 = year();
let t1 = hour();
let t2 = minute();
let t3 = second();
fill(0);
textAlign(CENTER);
textSize(50);
textFont('Helvetica');
text(d1 +'.' + d2 + '.' + d3, width/4, 100);
textSize(25);
text(t1 + ':' + t2 + ':' + t3, width/4, 140);
//}
//function mouseClicked(){
//if(mouseIsPressed){
}