Created
May 3, 2020 15:09
-
-
Save RobotGyal/20c2c91e28ea01e002fe28d65a7ac12b to your computer and use it in GitHub Desktop.
Fractal tree using Processing.py
This file contains 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
global theta | |
def setup(): | |
size(500,500) | |
def draw(): | |
background(255) | |
theta = map(mouseX,0,width,0,PI/2); | |
translate(width/2, height) | |
branch(100, theta) | |
def branch(len, theta): | |
line(0, 0, 0, -len); | |
translate(0, -len); | |
len *= 0.66; | |
if (len > 2): | |
pushMatrix() | |
rotate(theta) | |
branch(len, theta) | |
popMatrix() | |
pushMatrix() | |
rotate(-theta) | |
branch(len, theta) | |
popMatrix() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment