Created
November 22, 2020 15:50
-
-
Save villares/5bacea6bfe025afb6fa125e283e2fe85 to your computer and use it in GitHub Desktop.
Trying to Reconstruct Tim Szetela's rotational spirals
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
# based on work by Tim Szetela | |
# https://twitter.com/tszetela/status/1330287937808904194?s=20 | |
# result: https://twitter.com/villares/status/1330536893121957904?s=20 | |
def setup(): | |
size(600, 600) | |
fill(240, 240, 200) | |
stroke(150, 50, 50) | |
strokeWeight(2) | |
def draw(): | |
background(240, 240, 200) | |
translate(40, 100); scale(.75) | |
f = frameCount / 50.0 | |
n = 2 | |
step = 7 | |
w, h = 140, 15 | |
for i in range(0, int(360 * n) + 90, step): | |
y, a = i / 1.5, i | |
for j in range(3): | |
rotated_rect(100 + j * 200, y, w, h, radians(a) + f) | |
rotated_rect(200 + j * 200, y, w, h, HALF_PI - radians(a) - f) | |
def rotated_rect(x, y, w, h, ang): | |
push() | |
translate(x, y) | |
rotate(ang) | |
rectMode(CENTER) | |
rect(0, 0, w, h) | |
pop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment