本文介绍了当时间 = x 时如何创造一些事情发生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个关于正在处理中的计时器的问题.我想在每一秒过去后生成一个正方形.我会使用 for 循环、if 语句等吗?
I have a question about timers in Processing. I want to make a square spawn after every second that passes. Would I use a for loop, an if statement, etc.?
推荐答案
你可以在 if 中使用
语句.millis()
函数或 frameCount
变量
You could just use the millis()
function or the frameCount
variable in an if
statement.
像这样:
void draw(){
if(frameCount % 60 == 0){
//do something
}
}
更多信息可以在参考中找到.
More info can be found in the reference.
这篇关于当时间 = x 时如何创造一些事情发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!