-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathTextFromList.pv
More file actions
44 lines (36 loc) · 1.05 KB
/
Copy pathTextFromList.pv
File metadata and controls
44 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
Generate compositions using predefined words.
"""
size(600, 600)
txt = [
'DIE',
'BUY',
'WHY',
'NOW',
'!',
]
font('arial', 'black')
# Define some colors.
white = color(1,1,1)
black = color(0,0,0)
red = color(1,0,0)
translate(0,-200)
for i in range(100):
# The next line isn't inside of the `with transform()`, thus
# the translate() is appended every time. This might mean that
# the composition goes off-screen. This also means that
# it creates more interesting compositions. No risk, no reward...
translate(random(-100,100),random(-100,100))
# Save the current transformation. It's a good idea
# to do this in the beginning of a loop. End the
# loop with a pop.
with transform():
# Rotate in increments of 45 degrees.
rotate(random(5)*45)
fontsize(random(800))
fill(choice((white,black,red)))
# Half the time, change the text to lowercase.
someText = choice(txt)
if random(2) == 1:
someText = someText.lower()
text(someText, 0,0)