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.|
Updated on Mon Sep 21 15:53:24 2020.
If you see any errors or have comments, please let us know.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License