Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Animated Color Grid with DrawBot
canvasSize = 500
numSquares = 25
squareSize = canvasSize / numSquares
numFrames = 50
for frame in range(numFrames):
t = frame / numFrames
newPage(canvasSize, canvasSize)
frameDuration(1/25)
for i in range(numSquares):
x = i * squareSize
color_x = (1 + sin(2 * pi * (t + i / numSquares))) / 2
for j in range(numSquares):
color_y = (1 + sin(2 * pi * (t + j / numSquares))) / 2
fill(color_x, color_y, 0.5)
y = j * squareSize
rect(x, y, squareSize, squareSize)
saveImage("animated_color_grid.mp4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.