void draw() {
int s1 = second(); // Values from 0 - 59
int m1 = minute(); // Values from 0 - 59
int h1 = hour(); // Values from 0 - 23
int d2 = day(); // Values from 1 - 31
int m2 = month(); // Values from 1 - 12
int y2 = year(); // 2003, 2004, 2005, etc.
size(500, 200);
background(0);
// Background Clock
fill(#083100);
stroke(#27AA03);
rect(65, 55, 360, 70);
PFont font;
font = loadFont("DS-Digital-Bold-80.vlw");
// Time
fill(#27AA03);
textFont(font, 90);
text(h1, 70, 120); // Hour
text(":", 170, 115);
text(m1, 200, 120); // Minute
text(":", 300, 115);
text(s1, 330, 120); // Second
// Date
fill(#FCE000);
textFont(font, 40);
text(d2, 160, 40); // Day
text("/", 200, 40);
text(m2, 220, 40); // Month
text("/", 260, 40);
text(y2, 280, 40); // Year}
Syntax Error
** เมื่อนำการกำหนดค้าตัวแปรไปเป็น Global จะไม่สามารถทำให้นาฬิกาขยับได้
จึงต้องนำมาไว้ที่ void draw()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น