generated from mwc/project_drawing
167 lines
2.6 KiB
Python
167 lines
2.6 KiB
Python
# drawing.py
|
|
# ----------
|
|
# By ____(you)___________
|
|
#
|
|
# (Briefly describe what this program does.)
|
|
|
|
from turtle import *
|
|
from superturtle.animation import animate
|
|
|
|
bgcolor("black")
|
|
|
|
def fly(distance):
|
|
penup()
|
|
forward(distance)
|
|
pendown()
|
|
|
|
|
|
def sun():
|
|
color("yellow")
|
|
fillcolor("yellow")
|
|
begin_fill()
|
|
fly(40)
|
|
left(90)
|
|
circle(40)
|
|
right (90)
|
|
end_fill()
|
|
|
|
def orbit():
|
|
color("white")
|
|
fly(20)
|
|
left(90)
|
|
circle(60)
|
|
right(90)
|
|
fly(20)
|
|
left(90)
|
|
circle(80)
|
|
right(90)
|
|
fly(20)
|
|
left(90)
|
|
circle(100)
|
|
right(90)
|
|
fly(20)
|
|
left(90)
|
|
circle(120)
|
|
right(90)
|
|
fly(20)
|
|
left(90)
|
|
circle(140)
|
|
right(90)
|
|
fly(20)
|
|
left(90)
|
|
circle(160)
|
|
right(90)
|
|
fly(20)
|
|
left(90)
|
|
circle(180)
|
|
right(90)
|
|
fly(20)
|
|
left(90)
|
|
circle(200)
|
|
right(90)
|
|
right(180)
|
|
fly(200)
|
|
right(180)
|
|
|
|
def mercury():
|
|
fly(60)
|
|
color("thistle")
|
|
fillcolor("thistle")
|
|
begin_fill()
|
|
circle(3)
|
|
end_fill()
|
|
|
|
def venus():
|
|
left(126.869897646)
|
|
fly(100)
|
|
color("goldenrod")
|
|
fillcolor("goldenrod")
|
|
begin_fill()
|
|
circle(8)
|
|
end_fill()
|
|
left(53.1301)
|
|
|
|
def earth():
|
|
left(38.659808)
|
|
fly(128.062484749)
|
|
color("forest green")
|
|
fillcolor("forest green")
|
|
begin_fill()
|
|
circle(9)
|
|
end_fill()
|
|
left(51.340191)
|
|
|
|
def mars():
|
|
left(39.805571)
|
|
fly(156.204993518)
|
|
color("red")
|
|
fillcolor("red")
|
|
begin_fill()
|
|
circle(5)
|
|
end_fill()
|
|
left(50.194428)
|
|
|
|
def jupiter():
|
|
left(11.4356462439)
|
|
fly(101.198874263)
|
|
color("peru")
|
|
fillcolor("peru")
|
|
begin_fill()
|
|
circle(15)
|
|
end_fill()
|
|
|
|
def saturn():
|
|
left(74.186)
|
|
fly(212.602916255)
|
|
color("pale violet red")
|
|
fillcolor("pale violet red")
|
|
begin_fill()
|
|
circle(13)
|
|
end_fill()
|
|
|
|
|
|
def uranus():
|
|
left(90)
|
|
fly(240.831891576)
|
|
color("light blue")
|
|
fillcolor("light blue")
|
|
begin_fill()
|
|
circle(11)
|
|
end_fill()
|
|
left(48.366460)
|
|
|
|
def neptune():
|
|
left(41.987212)
|
|
fly(269.072480941)
|
|
color("blue")
|
|
fillcolor("blue")
|
|
begin_fill()
|
|
circle(11)
|
|
end_fill()
|
|
|
|
for frame in animate(120, loop=True):
|
|
sun()
|
|
orbit()
|
|
with frame.rotate(0, 360):
|
|
mercury()
|
|
with frame.rotate(0, 360):
|
|
venus()
|
|
with frame.rotate(0, 360):
|
|
earth()
|
|
with frame.rotate(0, 360):
|
|
mars()
|
|
with frame.rotate(0, 360):
|
|
jupiter()
|
|
with frame.rotate(0, 360):
|
|
saturn()
|
|
with frame.rotate(0, 360):
|
|
uranus()
|
|
with frame.rotate(0, 360):
|
|
neptune()
|
|
|
|
done()
|
|
|
|
|
|
|
|
|