generated from mwc/project_drawing
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:
parent
4a58ce02b7
commit
9bd0d8e285
|
@ -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()
|
||||
|
Loading…
Reference in New Issue