PFont QQ;
void setup()
{
size(1000,1000);
QQ = createFont("標楷體",100);
textFont(QQ);
fill(255,0,0);
textSize(80);
}
void draw()
{
background(#075BB2);
String hh=nf(hour(),2);
String mm=nf(minute(),2);
String ss=nf(second(),2);
text("現在:"+hh+":"+mm+":"+ss,50,100);
text("下課:15:40:00",50,200);
int now = hour()*60*60 + minute()*60+ second();
int next = 15 *60*60+40 *60+0;
int remain = next-now;
if(remain<0) remain +=24*60*60;
text("剩下:"+remain,50,300);
hh = nf(remain/60/60,2);
mm = nf(remain/60%60,2);
ss = nf(remain%60,2);
text("剩下:"+hh+":"+mm+":"+ss,50,400);
}
2021年11月15日 星期一
week06-哭啊轉守為攻
首先創建視窗 熟悉draw
加上Framecount 做出簡易文字時鐘
利用millis 長出一個時鐘
使用PFont印出電腦內字型
使用PFont 成功顯示中文
做出一個下課倒數計時!
程式碼如下:
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言