0
我正在處理一個小草圖,我正在使用時間函數繪製「時鐘」,並基於毫秒,秒和分鐘在畫布上繪製橢圓。我使用for循環來繪製所有的橢圓,每個for循環都在它自己的方法中。我在draw函數中調用每個這些方法。然而,由於某種原因,只有被調用的第一種方法正在繪製,理想情況下,我希望將它們全部呈現出來。[Processing/Java]可見性/分層問題
//setup program
void setup() {
size(800, 600);
frameRate(30);
background(#eeeeee);
smooth();
}
void draw(){
milliParticles();
secParticles();
minParticles();
}
//time based particles
void milliParticles(){
for(int i = int(millis()); i >= 0; i++) {
ellipse(random(800), random(600), 5, 5);
fill(255);
}
}
void secParticles() {
for(int i = int(second()); i >= 0; i++) {
fill(0);
ellipse(random(800), random(600), 10, 10);
}
}
void minParticles(){
for(int i = int(minute()); i >= 0; i++) {
fill(50);
ellipse(random(800), random(600), 20, 20);
}
}
你能鏈接討論線程的資源嗎?感謝您的回答。 – nnash
http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Thread.html –