xxxxxxxxxx
64
var fps;
var texts;
function setup() {
createCanvas(windowWidth, windowHeight);
//createCanvas(900, 900);
fps = 60;
frameRate(fps);
textSize(height/16);
//textFont('Libre Barcode 39');
textFont('VT323');
texts = [];
texts[0] = new floatingtext(second(),millis()/1000*width,height*3/16,width/1/fps,'second');
texts[1] = new floatingtext(minute(),second()/60*width,height*2/16,width/60/fps,'minute');
texts[2] = new floatingtext(hour(),minute()/60*width,height*7/16,width/3600/fps,'hour');
texts[3] = new floatingtext(day(),hour()/24*width,height*5/16,width/3600/24/fps,'day');
fill(255);
}
function draw() {
background(25,25,255);
for(var i=0;i<texts.length;i++){
texts[i].draw();
}
}
class floatingtext{
constructor(content,x, y, speed, type){
this.c = content;
this.x = parseFloat(x); //超ナゾ!
this.y = y;
this.s = parseFloat(speed);
this.isDead = false;
this.t = type
}
draw(){
text(this.c,this.x,this.y);
this.x += this.s;
if(this.x>=width){
this.x=0;
switch(this.t){
case 'second':
this.c = second();
break;
case 'minute':
this.c = minute();
break;
case 'hour':
this.c = hour();
break;
case 'day':
this.c = day();
break;
}
}
}
}
function touchStarted(){
}