import py5
First, define a setup()
function to create the drawing surface. This will be called once when the Sketch starts.
def setup():
py5.size(600, 400)
py5.background(128)
Second, define a draw()
function. This will be called repeatedly to create the Sketch animation.
def draw():
py5.rect(py5.random(py5.width), py5.random(py5.height), 10, 10)
py5.run_sketch()
This new draw()
function will replace the draw()
function defined earlier.
def draw():
py5.rect(py5.mouse_x, py5.mouse_y, 10, 10)
The second Sketch will use the new draw()
function and the settings()
and setup()
functions from before.
py5.run_sketch()