Alexandre B A Villares 2025-07-15 22:57:24 -03:00
rodzic 4a5ea96d74
commit deb2b491a5
3 zmienionych plików z 51 dodań i 0 usunięć

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 190 KiB

Wyświetl plik

@ -0,0 +1,41 @@
# An L-System made with Python and py5 in static/imported mode style
# Learn more at https://py5coding.org/content/py5_modes.html
size(950, 950)
background(255)
stroke(0)
stroke_weight(2)
step = 45
axiom = 'F'
rules = {'F': 'F[+F-F0][-F-F0][F-F0]'}
angle = 30
iterations = 5
starting_sequence = axiom
for i in range(iterations):
sequence = ''
for symbol in starting_sequence:
sequence = sequence + rules.get(symbol, symbol)
starting_sequence = sequence
translate(width * 0.5, height * 0.6)
for symbol in sequence:
if symbol == 'F':
line(0, 0, 0, -step)
translate(0, -step)
elif symbol == '+':
rotate(radians(-angle))
elif symbol == '-':
rotate(radians(angle))
elif symbol == '[':
push_matrix()
elif symbol == ']':
pop_matrix()
elif symbol == '0':
with push_style():
fill(255, 0, 0)
no_stroke()
circle(0, 0, step / 5)
save('out.png')

Wyświetl plik

@ -26,6 +26,16 @@ If you appreciate what I have been doing, you may also support my artistic work,
<!-- SKETCHES_START -->
### sketch_2025_07_15
![sketch_2025_07_15](https://raw.githubusercontent.com/villares/sketch-a-day/main/2025/sketch_2025_07_15/sketch_2025_07_15.png)
[sketch_2025_07_15](https://github.com/villares/sketch-a-day/tree/main/2025/sketch_2025_07_15) [[py5](https://py5coding.org/)]
---
### sketch_2025_07_14
![sketch_2025_07_14](https://raw.githubusercontent.com/villares/sketch-a-day/main/2025/sketch_2025_07_14/sketch_2025_07_14.png)