# Allison Obourn
# CS 115, Autumn 2021
# Lecture 8

# This program draws the outline of a circle in the center of the
# screen. The circle gets wider as the mouse moves away from the center and
# thinner as it gets closer to the center. It also draws an animal face with
# two eyes and a nose that follows the mouse. This shape's size can be changed
# by altering the shape_size variable. 

# NOTE: this program isn't finished! The animal eyes and nose do not adjust
#       correctly yet

from ECGUI import *

def repeat():
    # clear off the canvas and redraw a circle
    canvas.clear()

    # draws an outline of a circle
    # upper_left = canvas_width / 2 - oval_width / 2
    # starting_x = upper_left - (mouse_x - upper_left) / 2)
    x = canvas.get_mouse_x() - 135
    canvas.draw_oval(135 - x / 2, 235, x, 30)


    # draw an animal face
    x = canvas.get_mouse_x()
    y = canvas.get_mouse_y()

    shape_size = 50
    half_width = shape_size // 2
    
    canvas.fill_oval(x - half_width, y - half_width, shape_size, shape_size, "brown")
    canvas.fill_oval(10 + x - half_width, 20 + y - half_width, 5, 5, "black")
    canvas.fill_oval(35 + x - half_width, 20 + y - half_width, 5, 5, "black")
    canvas.fill_oval(x - 5, 40 + y - half_width, 10, 5, "black")

    

canvas = drawing_panel(300, 500, "white")
canvas.animate(50, repeat)
