Last active
March 21, 2020 21:28
-
-
Save eduairet/7309c9babd5b2ab18d4c271486f8db06 to your computer and use it in GitHub Desktop.
This code is intended to generate a Joy Division's Unknown Pleasures album cover image using DrawBot app
This file contains hidden or 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
# Tribute for Joy Division's Unknown Pleasures album cover | |
side = 1080 | |
def lsPts(): | |
points = [] | |
m = side*0.3 | |
for i in range(0, int(side*0.8), 12): | |
x = i | |
if side*0.2 >= i < side*0.4 or side*0.6 < i <= side*0.8: | |
y = sin((i*(randint(1, 3)))) | |
elif side*0.2 < i <= side*0.4: | |
y = i*sin(radians(i*(randint(-100, 100))))/10 | |
elif side*0.4 < i <= side*0.6: | |
y = m*sin(radians(m*(randint(-100, 100))))/10 | |
m -= 1 | |
if y < 0: | |
points.append((x, y * -1)) | |
else: | |
points.append((x, y)) | |
return points | |
print(lsPts()) | |
def lineGrid(steps): | |
for j in range(steps): | |
newPage(side, side) | |
fill(0) | |
rect(0, 0, side, side) | |
m = 0 | |
for i in range(int(side*0.8/13.5)): | |
points = lsPts() | |
fill(None) | |
stroke(1) | |
strokeWidth(1) | |
path = BezierPath() | |
with savedState(): | |
translate(side*0.1, side*0.1 + m) | |
path.moveTo((0, 0)) | |
path.curveTo(*points) | |
drawPath(path) | |
m += 13.5 | |
for i in range(12): | |
lineGrid(i) | |
saveImage('~/Desktop/unknown_pleasures.gif') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment