diff --git a/Turtle-a-thon/360-tree/360-tree.mp4 b/Turtle-a-thon/360-tree/360-tree.mp4 new file mode 100644 index 0000000..4a7d4c6 Binary files /dev/null and b/Turtle-a-thon/360-tree/360-tree.mp4 differ diff --git a/Turtle-a-thon/360-tree/README.md b/Turtle-a-thon/360-tree/README.md new file mode 100644 index 0000000..49c7a9a --- /dev/null +++ b/Turtle-a-thon/360-tree/README.md @@ -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 diff --git a/Turtle-a-thon/360-tree/main.py b/Turtle-a-thon/360-tree/main.py new file mode 100644 index 0000000..22cd710 --- /dev/null +++ b/Turtle-a-thon/360-tree/main.py @@ -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() \ No newline at end of file