From 8f1bc7512caaf5251c59f5f3c8761b6c565ca916 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 21 Sep 2024 22:33:06 -0400 Subject: [PATCH] I made a shapes.py file to keep my good shapes once I've finished them. I made a draw_leaf function and put it into a shapes.py because I think the leaf is pretty good. I started trying to draw the trunk / branches / roots of the tree, but it's not finished so I didn't put it into shapes.py yet. It was easy to make the leaf, I used two 90 degree arcs and a straight line between them equal to the chord length. I was trying to make branches with more branches coming off of them, but it was difficult to make the branches repeat the way I wanted to, so I am now just trying some basic rods for the main branches, and then once I figure out the loops for that I will figure out how to do loops to make little branches off of the main branches. --- README.md | 2 + __pycache__/shapes.cpython-310.pyc | Bin 0 -> 421 bytes drawing.py | 64 ++++++++++++++++++++++++++++- shapes.py | 9 ++++ 4 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 __pycache__/shapes.cpython-310.pyc create mode 100644 shapes.py diff --git a/README.md b/README.md index a457061..c57f70d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ image, move the image to this directory, and then use the following syntax: For this project, I want to make an animated tree with the leaves changing color and falling down. +---I am adding this line so it lets me do a commit message.--- + ) ## Planning diff --git a/__pycache__/shapes.cpython-310.pyc b/__pycache__/shapes.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f61ed6157846a935e4aede59f2796fd11eca5413 GIT binary patch literal 421 zcmYjNu};G<5WREK5=zU|jfJ%gMBR`;2#LK5ow`I(>@_fG8qBc+1pS4LGhbO-vp66a(7N3L1GC@j-td$tOSA#WcUuNKn@;Y zHf*U2X4v2bLFk^X&yZ99#^;dyp4?p#c-Yg-1I_U$#Q`byGeMUTd+@a7fKy;Dfi?{m z?TYT}QySTR(Wzynv#=Rv+GeF{23D^N-yG$})~S^?;4*8{uj&)*3DMu{*c#*GDt*$M zby90zB$<&auIg+a?>5@cRAJ3R;u^ literal 0 HcmV?d00001 diff --git a/drawing.py b/drawing.py index 29fc89e..f9538e5 100644 --- a/drawing.py +++ b/drawing.py @@ -1,7 +1,67 @@ # drawing.py # ---------- -# By ____(you)___________ +# By Stacy S # -# (Briefly describe what this program does.) +# (Trying to draw a tree.) from turtle import * +from math import sqrt +from shapes import draw_leaf + +def draw_trunk(height): + right(270) + forward(2*height) + circle(-height/16,90) + +def draw_branch(length): + + forward(length) + circle(length/8,180) + forward(length) + circle(-length/16,135) + + forward(length) + circle(length/8,180) + forward(length) + circle(-length/16,135) + + forward(length) + circle(length/8,180) + forward(length) + circle(-length/16,135) + + forward(length) + circle(length/8,180) + forward(length) + circle(-length/16,135) + + forward(length) + circle(length/8,180) + forward(length) + circle(-length/16,90) + + forward(2*length) + +# roots +# [1,3,3,1] + circle(-length/16,45) + + forward(length) + circle(length/8,180) + forward(length) + + circle(-length/16,135) + + forward(length) + circle(length/8,180) + forward(length) + + circle(-length/16,135) + + forward(length) + circle(length/8,180) + forward(length) + + circle(-length/16,45) + +input() \ No newline at end of file diff --git a/shapes.py b/shapes.py new file mode 100644 index 0000000..d9c29ca --- /dev/null +++ b/shapes.py @@ -0,0 +1,9 @@ +from turtle import * +from math import sqrt + +def draw_leaf(size): + circle(size,90) + right(270) + circle(size,90) + right(225) + forward(size*sqrt(2)) \ No newline at end of file