You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This animation is made with points in a Python collections.deque data structure, added by dragging the mouse (code shown bellow)
🔭 I'm currently working on a PhD at Unicamp.
🌱 I should be talking less and concentrating, but...
💬 Ask me about drawing with Python!
Check out py5 and pyp5js, they bring in the vocabulary from Processing & P5js!
I try to make a new drawing with code everyday, and I put the results at skech-a-day.
👯 I’d like to collaborate on open resources to teach programming.
I collect tools for teaching Python in a visual outputhere.
If you find the things I share here usefull, consider supporting my work! You can use this PayPal donation link, Wise, liberapay.com/villares, or if you are in Brazil, PIX: 46c37783-5edb-4f1c-b3a8-1309db11488c (chave aleatória).
⚡ Fun fact: I actually use this repo to store some helper code I use in my drawings.
fromcollectionsimportdeque# a double-ended queueimportpy5# check out https://github.com/py5coding history=deque(maxlen=512) # mouse dragged positionsdefsetup(): # py5 will call this once to set things uppy5.size(600, 400)
py5.no_stroke()
py5.color_mode(py5.HSB)
defdraw(): # py5 will call this in a looppy5.background(51)
fori, (x, y) inenumerate(history):
py5.fill(i/2, 255, 255, 128)
py5.circle(x, y, 8+i/16)
ifhistory:
history.append(history.popleft())
defmouse_dragged(): # py5 will call this when you drag the mousehistory.append((py5.mouse_x, py5.mouse_y))
defkey_pressed(): # py5 will call this when a key is pressedhistory.clear()
py5.run_sketch()