Reference for Processing (BETA) version 0135+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.
Name | noLoop() |
||
---|---|---|---|
Examples | void setup() { size(200, 200); noLoop(); } void draw() { line(10, 10, 190, 190); } void setup() { size(200, 200); } float x = 0.0; void draw() { background(204); x = x + 0.1; if (x > width) { x = 0; } line(x, 0, x, height); } void mousePressed() { noLoop(); } void mouseReleased() { loop(); } |
||
Description | Stops Processing from continuously executing the code within draw(). If loop() is called, the code in draw() begin to run continuously again. If using noLoop() in setup(), it should be the last line inside the block.
When noLoop() is used, it's not possible to draw to the screen inside event handling functions such as mousePressed() or keyPressed(). Instead, use those functions to call redraw() or loop(), which will run draw(), which can update the screen properly. Note that if the sketch is resized, redraw() will be called to update the sketch, even after noLoop() has been specified. Otherwise, the sketch would enter an odd state until loop() was called. |
||
Syntax | noLoop() |
||
Parameters | |||
Usage | Web & Application | ||
Related | loop() redraw() draw() |