Processing, redraw()
用法介紹。
用法
redraw()
返回
void
說明
執行一次draw()
內的代碼。該函數允許程序僅在必要時更新顯示窗口,例如當mousePressed()
或keyPressed()
注冊的事件發生時。
在構建程序時,隻有在 mousePressed()
等事件中調用 redraw() 才有意義。這是因為redraw()
不會立即運行draw()
(它隻設置一個指示需要更新的標誌)。
redraw()
函數在 draw()
內部調用時無法正常工作。要啟用/禁用動畫,請使用 loop()
和 noLoop()
。
例子
float x = 0;
void setup() {
size(200, 200);
noLoop();
}
void draw() {
background(204);
line(x, 0, x, height);
}
void mousePressed() {
x += 1;
redraw();
}
相關用法
- Processing red()用法及代碼示例
- Processing rect()用法及代碼示例
- Processing resetMatrix()用法及代碼示例
- Processing rectMode()用法及代碼示例
- Processing reverse()用法及代碼示例
- Processing requestImage()用法及代碼示例
- Processing return用法及代碼示例
- Processing resetShader()用法及代碼示例
- Processing randomGaussian()用法及代碼示例
- Processing rotateX()用法及代碼示例
- Processing round()用法及代碼示例
- Processing rotate()用法及代碼示例
- Processing rotateZ()用法及代碼示例
- Processing rotateY()用法及代碼示例
- Processing radians()用法及代碼示例
- Processing random()用法及代碼示例
- Processing randomSeed()用法及代碼示例
- Processing FFT用法及代碼示例
- Processing SawOsc.pan()用法及代碼示例
- Processing FloatDict用法及代碼示例
- Processing FFT.stop()用法及代碼示例
- Processing join()用法及代碼示例
- Processing () (parentheses)用法及代碼示例
- Processing Pulse用法及代碼示例
- Processing PShader用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 redraw()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。