Skip to content

Commit 0e23762

Browse files
committed
add readme example
1 parent d3084ea commit 0e23762

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

readme_example.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from p5 import *
2+
recording = True
3+
4+
def setup():
5+
size(640, 360)
6+
no_stroke()
7+
background(204)
8+
9+
def draw():
10+
if not recording:
11+
return
12+
13+
if mouse_is_pressed:
14+
fill(random_uniform(255), random_uniform(127), random_uniform(51), 127)
15+
else:
16+
fill(255, 15)
17+
18+
circle_size = random_uniform(low=10, high=80)
19+
20+
circle((mouse_x, mouse_y), circle_size)
21+
22+
def key_pressed(event):
23+
global recording
24+
if event.key == 'SPACE':
25+
recording = not recording
26+
background(204)
27+
28+
run()

0 commit comments

Comments
 (0)