Reference for Processing version 1.5. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name

### loop()

Examples

    void setup() {
      size(200, 200);
      noLoop();
    }

    float x = 0;

    void draw() {
      background(204);
      x = x + .1;
      if (x > width) {
        x = 0;
      }
      line(x, 0, x, height);
    }

    void mousePressed() {
      loop();
    }

    void mouseReleased() {
      noLoop();
    }

Description | Causes Processing to continuously execute the code within draw(). If noLoop() is called, the code in draw() stops executing.

Syntax

    loop()
    redraw()
    draw()

Returns | None
Usage | Web & Application
Related | noLoop()

Updated on August 30, 2010 04:29:39pm EDT