At My Fingertips

Documentation

Rolling Eyes

In this activity we will implement a function that allows us to generate a pair of rolling eyes, with the wanted size of the eye, size of the pupil, angle of the pupil , and distance of the pupil from the center of the eye.

rolling eyes

The circle function

In this activity, like in many others (as you might have noticed), it's useful to implement a circle function that only takes a diameter and a color, instead of always using the pytamaro ellipse or circular_sector functions when you want to generate a circle.

Implement the circle function using the ellipse function.

Loading...

The eye function

Description

Let's now implement the eye function that generates an eye of the given diameter, and with a pupil of the given pupil_diameter and whose center is positioned at pupil_distance from the eye's border. The position of the pupil depends on the given pupil_angle.

Make sure that the given pupil_distance doesn't place the pupil outside of the eye with an assertion.

Strategy

The following images can guide you through the decomposition of a rolling eye. Use the circle function you implemented.

eye

eye hint

Loading...

The rolling_eyes function

Now you have everything you need to implement the following rolling_eyes function! Notice that the left eye's direction depends on left_angle and the right side's direction depends on right_angle. Use the pytamaro function beside and the eye function that you just implemented

Loading...

This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.

Rolling Eyes

Logo of PyTamaro

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI

Privacy PolicyPlatform Version 0d7866a (Fri, 20 Dec 2024 07:46:38 GMT)