31 สิงหาคม 2558

Lab2 Digital Clock (Function)







void setup(){
size(250,250);
}

void draw(){
background(0);
clock_frame();
time();
date();
}

void time(){
fill(#A4A8CD);
textSize(20);
textAlign(CENTER);
text(nf(hour(), 2)+":"+nf(minute(), 2)+":"+nf(second(), 2), width/2, (height/2)-15);
}

void date(){
fill(#A4A8CD);
textSize(20);
textAlign(CENTER);
text(nf(day(), 2)+"/"+nf(month(), 2)+"/"+nf(year(), 2), width/2, (height/2)+15);
}

void clock_frame(){
rectMode(CENTER);
stroke(#05AAF5);
strokeWeight(5);
noFill();
rect(width/2,height/2-(5),150,100,15);
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น