From 9bd0d8e2853bbcf02760ea95a508aaf8997efe9e Mon Sep 17 00:00:00 2001 From: Chris Proctor Date: Wed, 25 Sep 2024 16:30:27 -0400 Subject: [PATCH] Adding orbit_test We did some live-coding to make a proof-of-concept for how to get the electrons to orbit! --- orbit_test.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 orbit_test.py diff --git a/orbit_test.py b/orbit_test.py new file mode 100644 index 0000000..e0dbc7d --- /dev/null +++ b/orbit_test.py @@ -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() +