-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Apoorva57/360-tree
360 tree
- Loading branch information
Showing
3 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 360-Tree🌳 | ||
|
||
I've used turtle GUI 🐢 to make a 360-degree fractal tree. It comprises three layers and recursion has been used to implement the logic. | ||
|
||
## Author 🎨 | ||
|
||
- **Apoorva** | ||
- GitHub: [Apoorva57](https://github.com/Apoorva57) 👾✨ | ||
|
||
## Project Showcase 🚀 | ||
|
||
Take a look at the beautiful green 360-degree fractal tree with detailed branching. | ||
|
||
https://github.com/user-attachments/assets/84123f07-088f-4cac-9490-e6543510fb52 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
import turtle | ||
|
||
t = turtle.Turtle() | ||
t.speed(0) | ||
turtle.bgcolor("black") | ||
t.left(90) | ||
t.speed(20) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(4) | ||
t.pencolor("peru") | ||
t.forward(l) | ||
t.left(30) | ||
draw(3 * l / 4) | ||
t.right(60) | ||
draw(3 * l / 4) | ||
t.left(30) | ||
t.backward(l) | ||
draw(20) | ||
t.right(90) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(4) | ||
t.pencolor("saddle brown") | ||
t.forward(l) | ||
t.left(30) | ||
draw(3 * l / 4) | ||
t.right(60) | ||
draw(3 * l / 4) | ||
t.left(30) | ||
t.backward(l) | ||
draw(20) | ||
t.left(270) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(4) | ||
t.pencolor("peru") | ||
t.forward(l) | ||
t.left(30) | ||
draw(3 * l / 4) | ||
t.right(60) | ||
draw(3 * l / 4) | ||
t.left(30) | ||
t.backward(l) | ||
draw(20) | ||
t.right(90) | ||
t.speed(2000) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(4) | ||
t.pencolor('saddle brown') | ||
t.forward(l) | ||
t.left(30) | ||
draw(3 * l / 4) | ||
t.right(60) | ||
draw(3 * l / 4) | ||
t.left(30) | ||
t.backward(l) | ||
|
||
|
||
draw(20) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(3) | ||
t.pencolor("light green") | ||
t.forward(l) | ||
t.left(30) | ||
draw(4 * l / 5) | ||
t.right(60) | ||
draw(4 * l / 5) | ||
t.left(30) | ||
t.backward(l) | ||
draw(40) | ||
t.right(90) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(3) | ||
t.pencolor("sea green") | ||
t.forward(l) | ||
t.left(30) | ||
draw(4 * l / 5) | ||
t.right(60) | ||
draw(4 * l / 5) | ||
t.left(30) | ||
t.backward(l) | ||
draw(40) | ||
t.left(270) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(3) | ||
t.pencolor("light green") | ||
t.forward(l) | ||
t.left(30) | ||
draw(4 * l / 5) | ||
t.right(60) | ||
draw(4 * l / 5) | ||
t.left(30) | ||
t.backward(l) | ||
draw(40) | ||
t.right(90) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(3) | ||
t.pencolor('sea green') | ||
t.forward(l) | ||
t.left(30) | ||
draw(4 * l / 5) | ||
t.right(60) | ||
draw(4 * l / 5) | ||
t.left(30) | ||
t.backward(l) | ||
draw(40) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(1) | ||
t.pencolor("light green") | ||
t.forward(l) | ||
t.left(30) | ||
draw(6 * l / 7) | ||
t.right(60) | ||
draw(6 * l / 7) | ||
t.left(30) | ||
t.backward(l) | ||
draw(45) | ||
t.right(90) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(1) | ||
t.pencolor("sea green") | ||
t.forward(l) | ||
t.left(30) | ||
draw(6 * l / 7) | ||
t.right(60) | ||
draw(6 * l / 7) | ||
t.left(30) | ||
t.backward(l) | ||
draw(45) | ||
t.left(270) | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(1) | ||
t.pencolor("light green") | ||
t.forward(l) | ||
t.left(30) | ||
draw(6 * l / 7) | ||
t.right(60) | ||
draw(6 * l / 7) | ||
t.left(30) | ||
t.backward(l) | ||
draw(45) | ||
t.right(90) | ||
# recursion | ||
def draw(l): | ||
if (l < 10): | ||
return | ||
else: | ||
t.pensize(1) | ||
t.pencolor('sea green') | ||
t.forward(l) | ||
t.left(30) | ||
draw(6 * l / 7) | ||
t.right(60) | ||
draw(6 * l / 7) | ||
t.left(30) | ||
t.pensize(1) | ||
t.backward(l) | ||
|
||
draw(45) | ||
t.hideturtle() | ||
turtle.done() |