Skip to content

Commit

Permalink
Create sketch_2024_12_04t.py
Browse files Browse the repository at this point in the history
  • Loading branch information
villares committed Dec 4, 2024
1 parent 2d7721c commit 9758223
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 2024/sketch_2024_12_04/sketch_2024_12_04t.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
angulo = radians(22)

def setup():
size(500, 500)

def draw():
random_seed(1)
background(240, 240, 200)
translate(250, 300) # desloca a origem, o 0,0 das coordenadas
galho(60)

def galho(tamanho):
stroke_weight(tamanho / 8)
line(0, 0, 0, -tamanho)
encurtamento = 0.9 - random(0.3)
if tamanho > 5:
a = angulo + (random(2) - 1) / 6
b = angulo + (random(2) - 1) / 6
push_matrix() # uma maneira de salvar o estado atual das coordenadas, usado em conjunto com `pop_matrix()`
translate(0, -tamanho)
rotate(a)
galho(tamanho * encurtamento)
rotate(-a * 2)
galho(tamanho * encurtamento)
pop_matrix() # retoma o estado do sistema de coordenadas salvo por `push_matrix()`

0 comments on commit 9758223

Please sign in to comment.