From b8fdf23cb776e43581232f4a0d5c7f9e10c4dab8 Mon Sep 17 00:00:00 2001 From: njmason2 Date: Fri, 19 Sep 2025 14:21:09 -0400 Subject: [PATCH] drawing.py --- drawing.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/drawing.py b/drawing.py index e3f16ad..81ee885 100644 --- a/drawing.py +++ b/drawing.py @@ -1,7 +1,62 @@ # drawing.py # ---------- # Nelson Mason +# updated 9-19-2025 # Due by 9-29-2025 # (This is an animation of a sunrise.) from turtle import * + +# define 3 objects +# sky, ground, sun + +# In the actual animation, the sun will start off entirely below the horizon, +# (where the sky meets the ground), hidden by the ground, and will slowly rise (move up the screen), +# with the sun, sky, and ground changing color. The disk of the sun will +# be apparent only in the sky, as it rises. The elapsed_time will be linked to the +# animation frames. I will be using color shading techniques in the animation. + +def sky(): + for x in range(2): + forward(400) + left(90) + forward(300) + left(90) + + +def ground(): + for x in range(2): + forward(400) + right(90) + forward(150) + right(90) + + +def sun(): + forward(200) + circle(75,360) + +penup() # reposition the turtle before drawing the 3 objects +right(180) +forward(200) +left(90) +forward(50) +left(90) +pendown() + +begin_fill() # draw the sky +fillcolor("dark blue") +sky() +end_fill() + +begin_fill() # draw the ground +fillcolor("black") +ground() +end_fill() + +begin_fill() # draw the sun +fillcolor("red") +sun() +end_fill() + +input()