diff --git a/demo.py b/demo.py new file mode 100644 index 0000000..84acb46 --- /dev/null +++ b/demo.py @@ -0,0 +1,33 @@ +from turtle import * +from superturtle.movement import fly +from superturtle.animation import animate +from superturtle.easing import easeOutBounce + +def nopen(distance): + "Move with the pen up" + penup() + forward(distance) + pendown() + +def beachball(radius, n_seams=6): + """Draws a beach ball centered at the turtle's current position. + When finished, leaves the turtle at the original position. + """ + left(90) + nopen(radius) + right(90) + circle(radius) + left(90) + nopen(radius) + right(90) + + for seam in range(n_seams): + circle(radius/2, 180) + circle(radius/2, -180) + right(360/n_seams) + +for frame in animate(256, loop=True): + x = frame.interpolate(-100, 100) + y = frame.interpolate(200, -100, easing=easeOutBounce) + fly(x, y) + beachball(40)