当时间 = x 时,如何创造发生的事情
How to create something happen when time = x
我对 Processing 中的计时器有疑问。我想在每一秒过去后生成一个正方形。我会使用 for 循环、if 语句等吗?
您可以在 if
语句中使用 millis()
函数或 frameCount
变量。
像这样:
void draw(){
if(frameCount % 60 == 0){
//do something
}
}
可以在 the reference 中找到更多信息。
我对 Processing 中的计时器有疑问。我想在每一秒过去后生成一个正方形。我会使用 for 循环、if 语句等吗?
您可以在 if
语句中使用 millis()
函数或 frameCount
变量。
像这样:
void draw(){
if(frameCount % 60 == 0){
//do something
}
}
可以在 the reference 中找到更多信息。