Skip to content

Instantly share code, notes, and snippets.

@BenjaminSantiago
Created November 21, 2022 19:15
Show Gist options
  • Save BenjaminSantiago/2e9c405dcfa336886d413c83bd3887f8 to your computer and use it in GitHub Desktop.
Save BenjaminSantiago/2e9c405dcfa336886d413c83bd3887f8 to your computer and use it in GitHub Desktop.
Our little drawing example but with the ability to save. Check your project folder to find the actual files.
drawing = False
def setup():
size(500,500)
background(240)
stroke(220,0, 220)
strokeWeight(20)
def draw():
global drawing
if drawing is True:
line(pmouseX, pmouseY, mouseX, mouseY)
def mousePressed():
global drawing
if drawing is False:
drawing = True
def mouseReleased():
global drawing
if drawing is True:
drawing = False
def keyReleased():
if key == 'e':
background(240)
if key == 's':
saveFrame('screen__#####.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment