project_drawing/orbit_test.py

28 lines
595 B
Python

from turtle import *
from superturtle.animation import animate
from superturtle.movement import restore_state_when_finished
DOTSIZE = 10
def electron(radius):
"""Assumes the turtle already has the proper heading.
"""
with restore_state_when_finished():
penup()
forward(radius)
pendown()
dot(DOTSIZE)
for frame in animate(360, loop=True):
with frame.rotate(0, 359, cycles=2):
electron(100)
right(180)
electron(100)
with frame.rotate(0, 359):
electron(140)
right(180)
electron(140)
input()