Skip to content

Instantly share code, notes, and snippets.

@justvanrossum
Created April 5, 2020 18:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justvanrossum/b4cc0f81d4dbcac1dc28f9cc3c62020e to your computer and use it in GitHub Desktop.
Save justvanrossum/b4cc0f81d4dbcac1dc28f9cc3c62020e to your computer and use it in GitHub Desktop.
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