Created
September 5, 2024 12:35
-
-
Save justvanrossum/f1c8b205291c2e207507b5e3d7d44a6f to your computer and use it in GitHub Desktop.
Animated Concentric Circles remake of book cover (DrawBot script)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In honor of https://www.instagram.com/p/C_iATyCiGu0/ | |
# John Hinton / Dying (Pelican originals; Studies in social pathology) | |
# Designer unknown | |
def circle(x, y, d): | |
r = d / 2 | |
oval(x - r, y - r, d, d) | |
canvasSize = 1080 | |
margin = 0.02 * canvasSize | |
diameter = canvasSize - 2 * margin | |
numCircles = 48 | |
step = diameter / (2 * numCircles) | |
numFrames = 120 | |
colors = [ | |
(0,), | |
( | |
1, | |
0.95, | |
0.9, | |
), | |
] | |
for frame in range(numFrames): | |
t = frame / numFrames | |
newPage(canvasSize, canvasSize) | |
frameDuration(1 / 30) | |
# background | |
fill(0.75, 0, 0.25) | |
rect(0, 0, canvasSize, canvasSize) | |
translate(canvasSize / 2, canvasSize / 2) | |
offsetfactor = -cos(tau * t) | |
for i in range(numCircles): | |
f = 1 - i / (numCircles) | |
d = f * diameter | |
fill(*colors[i % 2]) | |
offset = step if not i % 2 else 0 | |
circle(offsetfactor * offset, 0, d + 0.7 * offset) | |
saveImage("ConcentricCircles2024.mp4") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment