Name

clear()

Examples
def setup(): 
    size(200, 200)
    global pg
    pg = createGraphics(100, 100)

def draw(): 
    background(204)
    pg.beginDraw()
    pg.stroke(0, 102, 153)
    pg.line(0, 0, mouseX, mouseY)
    pg.endDraw()
    image(pg, 50, 50)

# Click to clear the PGraphics object
def mousePressed(): 
    pg.clear()
Description Clears the pixels within a buffer. This function only works on PGraphics objects created with the createGraphics() function; it won't work with the main display window. Unlike the main graphics context (the display window), pixels in additional graphics areas created with createGraphics() can be entirely or partially transparent. This function clears everything to make all of the pixels 100% transparent.
Syntax
clear()

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

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