diff --git a/chris_ellipse_exploration/demo.gif b/chris_ellipse_exploration/demo.gif new file mode 100644 index 0000000..321828a Binary files /dev/null and b/chris_ellipse_exploration/demo.gif differ diff --git a/chris_ellipse_exploration/demo.html b/chris_ellipse_exploration/demo.html new file mode 100644 index 0000000..0817ef6 --- /dev/null +++ b/chris_ellipse_exploration/demo.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/chris_ellipse_exploration/demo.py b/chris_ellipse_exploration/demo.py new file mode 100644 index 0000000..a3c8e85 --- /dev/null +++ b/chris_ellipse_exploration/demo.py @@ -0,0 +1,26 @@ +from ellipse import ellipse +from superturtle.animation import animate +from superturtle.easing import easeInOutCubic +from turtle import color, fillcolor, begin_fill, end_fill + +n_frames = 128 + +def is_even(n): + return n % 2 == 0 + +def set_colors(n): + "Sets the color and fill color to white when n is even, otherwise black." + if is_even(n): + color('white') + fillcolor('white') + else: + color('black') + fillcolor('black') + +for frame in animate(n_frames, loop=True, gif_filename="demo.gif"): + for r in reversed(range(2, 30)): + set_colors(r) + with frame.rotate(0, 360, r, n_frames - r, easing=easeInOutCubic): + begin_fill() + ellipse(5 * r, 10 * r, 128) + end_fill()