Published in: Python
This NodeBox script is a quick hack; ugly code, no documentation, but I was asked about it, so here it is. Apparently each dot in the dots list is a list that contains, in this order, x coordinate, y coordinate, orientation, and scale of an arrow. From this you should be able to figure out the rest, the code isn't that long after all.
import math width, height = 600, 480 #width, height = 300, 240 size(width, height) speed(30) def rotatePoint(x, y, centreX, centreY, degrees): angle = (degrees / 180.0) * math.pi x -= centreX y -= centreY x, y = math.cos(angle)*x - math.sin(angle)*y, math.sin(angle)*x + math.cos(angle)*y x += centreX y += centreY return (x, y) def setup(): global frame frame = 0 global dots # (y - x)*10.0 dots = [[30*x, 30*y, (x + y)*20.001, 1.0] for x in xrange(-20, 20) for y in xrange(-14, 14)] #dots = [[30*x, 30*y, (x + y)*20.001, 1.0] for x in xrange(-10, 10, 1) for y in xrange(-8, 8, 1)] #dots = [[30*x, 30*y, (x + y)*20.001, 1.0] for x in xrange(-20, 20, 6) for y in xrange(-14, 14, 6)] def stepDots(): global dots for d in dots: d[2] += (math.sqrt(math.pow(d[0]*0.3, 2) + math.pow(d[1]*0.2, 2)))*0.08 d[3] = math.sin(math.radians(d[2])/5.0) xInc, yInc = rotatePoint(1.76, 0.0, 0.0, 0.0, -1.0*(d[2] % 360)) sc = math.pow(1.0 - d[3], 2.8) if d[3] < 0: sc *= -1.0 d[0] += xInc*sc d[1] += yInc*sc def drawObject(x, y, o): for z in xrange(-12, 13, 5): xOff, yOff = rotatePoint(z, 0.0, 0.0, 0.0, -1.0*o) arrow(x + xOff, y + yOff, 30) def draw(): global frame global distort global dots stepDots() nofill() strokewidth(5) # 5 colormode(HSB) translate(300, 240) #translate(150, 120) #rotate(-1.3 * frame) for d in dots: push() o = d[2] % 360 rotate(o) stroke(math.sin(d[3]*20.0)*0.1 + (math.sin(frame/48.0)*0.4 + 0.5), 0.7, 0.5, 0.125 - abs(d[3]*0.25)) scale(d[3]*10.15) #rect(d[0], d[1], 10, 10) drawObject(d[0], d[1], o) pop() frame += 1
You need to login to post a comment.
