Created
April 14, 2016 11:55
-
-
Save fdb/15ae20a78da6d75e2fd68630f52505c8 to your computer and use it in GitHub Desktop.
NodeBox 1 random letter script
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
# NodeBox 1 script that generates a composition of random letters. | |
# Download NodeBox 1 at https://www.nodebox.net/download/ | |
size(800, 400) | |
from random import choice, uniform, seed | |
seed(52) | |
colors = [[0, 0, 0], [1, 0, 0], [1, 1, 1]] | |
def comp(x, y, w, h): | |
push() | |
p = rect(x, y, w, h, draw=False) | |
beginclip(p) | |
font("Helvetica-Bold") | |
for i in range(6): | |
sz = random(100, 500) | |
fontsize(sz) | |
rotate(random(8) * 45) | |
fill(*choice(colors)) | |
text("B", x + random(w), y + random(h) + sz / 2, width=0) | |
endclip() | |
pop() | |
nofill() | |
stroke(0) | |
strokewidth(0.5) | |
rect(x, y ,w , h) | |
for x, y in grid(4, 2, 200, 200): | |
comp(x, y, 200, 200) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Screenshot: