Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Drawbot animation that takes advantage of the strange aliasing effects of quantized trigonometric functions. The result is here: https://twitter.com/pents90/status/701557854147362817
# DrawBot
import math;
SIZE = 512
FRAMES = 120
STEP = 8
size(SIZE,SIZE)
for t in xrange(0, FRAMES):
fill(0,0,0)
rect(0,0,SIZE,SIZE)
for x in xrange(0, SIZE, STEP):
tx = math.cos(x * math.pi * 2 / SIZE + math.pi) + 1
for y in xrange(0, SIZE, STEP):
ty = math.cos(y * math.pi * 2 / SIZE + math.pi) + 1
if (math.sin(tx * (t + 1) * ty) < 0):
fill(0,0,0)
else:
fill(1,1,1)
rect(x,y,STEP,STEP)
if (t < FRAMES - 1):
newPage()
saveImage(u"~/Desktop/animation.gif")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment