At My Fingertips

Rapid Playground

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 PyTamaro iconellipse or PyTamaro iconcircular_sector functions when you want to generate a circle.

Implement the circle function using the PyTamaro iconellipse 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 PyTamaro iconbeside 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 53000ec (Tue, 07 May 2024 13:57:12 GMT)