generated from mwc/project_drawing
drawing.py
This commit is contained in:
29
drawing.py
29
drawing.py
@@ -6,6 +6,7 @@
|
||||
# (This is an animation of a sunrise.)
|
||||
|
||||
from turtle import *
|
||||
from superturtle.animation import animate
|
||||
|
||||
# define 3 objects
|
||||
# sky, ground, sun
|
||||
@@ -23,7 +24,6 @@ def sky():
|
||||
forward(300)
|
||||
left(90)
|
||||
|
||||
|
||||
def ground():
|
||||
for x in range(2):
|
||||
forward(400)
|
||||
@@ -31,11 +31,15 @@ def ground():
|
||||
forward(150)
|
||||
right(90)
|
||||
|
||||
|
||||
def sun():
|
||||
forward(200)
|
||||
circle(75,360)
|
||||
|
||||
|
||||
def sun_reposition():
|
||||
left(90)
|
||||
forward(20)
|
||||
right(90)
|
||||
|
||||
penup() # reposition the turtle before drawing the 3 objects
|
||||
right(180)
|
||||
forward(200)
|
||||
@@ -54,9 +58,20 @@ fillcolor("black")
|
||||
ground()
|
||||
end_fill()
|
||||
|
||||
begin_fill() # draw the sun
|
||||
fillcolor("red")
|
||||
sun()
|
||||
end_fill()
|
||||
penup()
|
||||
right(90)
|
||||
forward(150)
|
||||
left(90)
|
||||
forward(200)
|
||||
pendown()
|
||||
|
||||
# for frame in animate(40, loop=True):
|
||||
# x = frame.interpolate(0,15)
|
||||
for x in range(15):
|
||||
begin_fill() # draw the sun
|
||||
fillcolor("red")
|
||||
sun()
|
||||
sun_reposition()
|
||||
end_fill()
|
||||
|
||||
input()
|
||||
|
||||
Reference in New Issue
Block a user