At My Fingertips
Rapid Playground
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.
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.
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.
The following images can guide you through the decomposition of a rolling eye. Use the circle
function you implemented.
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
This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.
Rolling Eyes
PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version c08406b (Wed, 20 Nov 2024 12:30:00 GMT)