Created
September 6, 2022 08:44
-
-
Save tabreturn/276a2df30dc12b6e64e927c75fc05fea to your computer and use it in GitHub Desktop.
py5_modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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