Skip to content

Instantly share code, notes, and snippets.

@RobotGyal
Created May 3, 2020 15:09
Show Gist options
  • Save RobotGyal/20c2c91e28ea01e002fe28d65a7ac12b to your computer and use it in GitHub Desktop.
Save RobotGyal/20c2c91e28ea01e002fe28d65a7ac12b to your computer and use it in GitHub Desktop.
Fractal tree using Processing.py
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