"""
A demonstration of simple animation using the Zelle graphics library.

Author: Zachary Palmer
Date: 2015-09-28
"""

from graphics import *
from time import *

def make_circle(size):
  circle = Circle(Point(300,300), size)
  circle.setFill("white")
  return circle

def main():
  window = GraphWin("Animation", 600, 600)
  window.setBackground("black")
  
  min_size = 20
  max_size = 200

  current_size = min_size
  growing = True
  
  while window.isOpen():
    circle = make_circle(current_size)
    circle.draw(window)
    
    sleep(0.02)
  
    if growing:
      current_size += 2
      if current_size >= max_size:
          growing = False
    else:
      current_size -= 2
      if current_size <= min_size:
          growing = True

    circle.undraw()

main()
