互動技術概論-時鐘-20211115
寫字字
void setup(){
size(600,600);///視窗大小
fill(255,0,0);///字顏色
textSize(80);///字大小
}
void draw(){
text("Hello",50,100);///寫的字
}
size(600,600);///視窗大小
fill(255,0,0);///字顏色
textSize(80);///字大小
}
void draw(){
text("Hello",50,100);///寫的字
}
跑秒
void setup(){
size(600,600);
fill(255,0,0);
textSize(80);
}
void draw(){
background(255);
text("Time:"+frameCount,50,100);
}
完成碼表
void setup(){
size(600,600);
fill(255,0,0);
textSize(80);
}
void draw(){
background(255);
text("Time:"+frameCount/60,50,100);///
text("millis()"+millis()/1000,50,200);///毫秒
}
size(600,600);
fill(255,0,0);
textSize(80);
}
void draw(){
background(255);
text("Time:"+frameCount/60,50,100);///
text("millis()"+millis()/1000,50,200);///毫秒
}
時鐘出來了
void setup(){
size(600,600);
fill(255,0,0);
textSize(80);
}
void draw(){
background(255);
text(hour()+":"+minute()+":"+second(),50,100);
text("millis()"+millis()/1000,50,200);
}
寫中文PFont myFont;
void setup(){
size(500,500);
myFont = createFont("標楷體",100);
textFont(myFont);
text("中文",100,100);
}PFont font1,font2;void setup(){ size(500,500); font1=createFont("標楷體",100); textFont(font1); font2=createFont("微軟正黑體 Bold",100);}void draw(){ background(0); text("中文",100,100); if(mousePressed) textFont(font2); else textFont(font1);}顯示現在的時間void setup(){ size(600,600); fill(255,0,0); textSize(80);}void draw(){ background(255); String hh=nf(hour(),2); String mm=nf(minute(),2); String ss=nf(second(),2); text(hh+":"+mm+":"+ss,50,100);}計算剩下的時間void setup(){ size(500,500); fill(255);//填充顏色 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; text(remain,50,300);}
PFont myFont;
void setup(){
size(500,500);
myFont = createFont("標楷體",100);
textFont(myFont);
text("中文",100,100);
}
void setup(){
size(500,500);
myFont = createFont("標楷體",100);
textFont(myFont);
text("中文",100,100);
}
PFont font1,font2;
void setup(){
size(500,500);
font1=createFont("標楷體",100);
textFont(font1);
font2=createFont("微軟正黑體 Bold",100);
}
void draw(){
background(0);
text("中文",100,100);
if(mousePressed) textFont(font2);
else textFont(font1);
}
顯示現在的時間
void setup(){
size(600,600);
fill(255,0,0);
textSize(80);
}
void draw(){
background(255);
String hh=nf(hour(),2);
String mm=nf(minute(),2);
String ss=nf(second(),2);
text(hh+":"+mm+":"+ss,50,100);
}
計算剩下的時間
void setup(){
size(500,500);
fill(255);//填充顏色
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;
text(remain,50,300);
}

沒有留言:
張貼留言