Adding orbit_test

We did some live-coding to make a proof-of-concept
for how to get the electrons to orbit!
This commit is contained in:
Chris Proctor 2024-09-25 16:30:27 -04:00
parent 4a58ce02b7
commit 9bd0d8e285
1 changed files with 27 additions and 0 deletions

27
orbit_test.py Normal file
View File

@ -0,0 +1,27 @@
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()