FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
plotdevice/examples/Drawing/Transformer.pv at main · plotdevice/plotdevice · GitHub
plotdevice
plotdevice
Repository navigation
Code
Issues
10
(10)
Pull requests
4
(4)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
plotdevice
/
examples
/
Drawing
/
Transformer.pv
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (20 loc) · 911 Bytes
Breadcrumbs
plotdevice
/
examples
/
Drawing
/
Transformer.pv
Copy path
File metadata and controls
27 lines (20 loc) · 911 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""Cumulative transformations for very large and very small compositions."""
size(600, 600)
translate(WIDTH/2, HEIGHT/2)
scale(5)
# Because we don't use `with transform()` anywhere, all the transformations
# are appended to one another. This means that, depending on the random value, a
# composition might grow to be very big or very small.
for i in range(100):
# Wobble the orientation a bit in either direction:
rotate(random(-10, 10))
# Use the next line instead of the previous ones to keep everything
# aligned to compass directions:
# rotate(random(1,4)*45)
scale(random(0.6,1.4))
translate(random(-5,5),random(-5,5))
# After all transformations are done, pick a color and draw the shape.
fill(random()-0.4, 0.2, 0.2, random())
poly(0,0, 5)
# To see how it looks with shapes other than squares, try:
# star(0,0,points=random(5,50),inner=1,outer=14)
Back
|
FazBrowse Home
|
New Git URL