drawing.py

This commit is contained in:
njmason2
2025-09-19 14:21:09 -04:00
parent 3a2508ce31
commit b8fdf23cb7

View File

@@ -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()