Skip to content

Instantly share code, notes, and snippets.

@jsundram
Last active December 19, 2015 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsundram/5982329 to your computer and use it in GitHub Desktop.
Save jsundram/5982329 to your computer and use it in GitHub Desktop.
Implementation of BoxyLady2 aimed at pyprocessing
"""https://code.google.com/p/pyprocessing/wiki/QuickReference#Pyprocessing_Documentation"""
from pyprocessing import *
from random import randint as random
MAXS = 40
MINS = 1
pic = None
grow = False
box_size = MAXS
def setup():
global pic
pic = loadImage("pic.jpg")
pic.loadPixels()
size(pic.width, pic.height)
noStroke()
def draw():
global box_size, grow
make(box_size)
if not grow:
box_size -= 1
if box_size < MINS:
grow = True
if grow:
box_size += 1
if MAXS < box_size:
grow = False
exit()
print frame.rate
def make(i):
global pic
noStroke();
for _ in xrange(width*height/2):
x = int(random(0, width-1))
y = int(random(0, height-1))
fill(pic.get(x, y));
rect(x, y, int(random(MINS, i)), int(random(MINS, i)))
save("ani/image%03d.png" % frame.count)
def keyPressed():
if key == 's':
saveFrame("images/image##.jpg")
if __name__ == '__main__':
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment