Replies: 1 comment 7 replies
-
update - it can use objects if I insist on using class and give a name for it: import py5
class myCircle:
def __init__(self, x, y, size=50):
self.x = x
self.y = y
self.size = size
self.color = (0, 0, 0)
def display(self):
py5.fill(*self.color)
py5.circle(self.x, self.y, self.size)
def move(self, dx, dy):
self.x += dx
self.y += dy
self.color = (py5.map(self.x, 0, py5.width, 0, 255),
py5.map(self.y, 0, py5.height, 0, 255),
0)
circle = myCircle(py5.width // 2, py5.height // 2)
def setup():
py5.size(400, 400)
def draw():
py5.background(255)
circle.display()
circle.move(py5.random_uniform(-5, 5), py5.random_uniform(-5, 5))
py5.run_sketch() |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Some days ago my student showed me sketch in py5 made with a help of chatGPT, I've decided to make some experiments too. This one looks nice:
Results:
I'll continue my experiments. )
Beta Was this translation helpful? Give feedback.
All reactions