/ Published in: Python
I was just asked how I did this
http://www.vimeo.com/clip:218013
so here goes ...
http://www.vimeo.com/clip:218013
so here goes ...
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import math width, height = 400, 300 size(width, height) speed(8) def setup(): global frame frame = 1 global dots dots = [[50*x + 25, 50*y + 25, (y - x)*10.0] for x in xrange(8) for y in xrange(6)] def stepDots(): global dots for d in dots: d[2] += (d[0] + d[1])*0.01 def draw(): global frame global distort global dots stepDots() nofill() strokewidth(5) colormode(HSB) for d in dots: push() rotate(d[2]) h = math.sin(math.radians(d[2])/5.0)*20.0 stroke(math.sin(h)*0.1 + (math.sin(frame/48.0)*0.4 + 0.5), 0.7, 0.5, 1 - abs(h/15.0)) scale(h/1.3) #rect(d[0], d[1], 10, 10) arrow(d[0], d[1], 20) pop() frame += 1