Skip to content

Instantly share code, notes, and snippets.

@tabreturn
Created September 6, 2022 08:44
Show Gist options
  • Save tabreturn/276a2df30dc12b6e64e927c75fc05fea to your computer and use it in GitHub Desktop.
Save tabreturn/276a2df30dc12b6e64e927c75fc05fea to your computer and use it in GitHub Desktop.
py5_modules
# add these two lines to the top of any imported module
from py5 import *
cs = get_current_sketch()
class Amoeba():
def __init__(self, x, y):
self.location = Py5Vector(x, y)
def display(self):
circle(self.location.x, self.location.y, 50)
def move_using_framecount(self):
# note how cs refers to main sketch instance
self.location.x = cs.frame_count
from amoeba import Amoeba
bob = Amoeba(30, 250)
def setup():
size(500, 500)
def draw():
bob.move_using_framecount()
bob.display()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment