Name

loop()

Examples
x = 0

def setup():
    size(200, 200)
    noLoop()  # draw() will not loop

def draw():
    background(204)
    global x
    x = x + .1
    if x > width:
        x = 0

    line(x, 0, x, height)

def mousePressed():
    loop()  # Holding down the mouse activates looping

def mouseReleased():
    noLoop()  # Releasing the mouse stops looping draw()

THIS EXAMPLE IS BROKEN

Description By default, Processing loops through draw() continuously, executing the code within it. However, the draw() loop may be stopped by calling noLoop(). In that case, the draw() loop can be resumed with loop().
Syntax
loop()
Related noLoop()
redraw()
draw()

Updated on Tue Feb 27 14:07:12 2024.

If you see any errors or have comments, please let us know.