At My Fingertips
Rapid Playground
Compose a graphic of a sliced Pitaya, a fruit also known as "dragon fruit".
The small seeds of a pitaya are distributed all throughout the fruit.
They are dark (the color is already defined in SEED_COLOR
)
and have an elliptical shape (about half as wide as long).
Implement the pitaya_seed
function, using ellipse.
Compose a sliced pitaya without any seeds.
Use the given colors for the skin (SKIN_COLOR
) and the flesh (FLESH_COLOR
).
The sliced pitaya should have the given overall diameter
,
and the flesh should be 90% of that diameter.
Create a function ring
that produces a ring of count
seeds, evenly spread across the 360 degrees of a circle.
The inside diameter of the ring should correspond to diameter
(the seeds should form a ring just outside the diameter).
Repetitively call pitaya_seed
to produce the ring of seeds.
Here is an example of calling ring(8, 100, pitaya_seed(20))
:
Hint: The seeds must be placed half the diameter away from the center of the ring. To do that, create a rectangle that is as wide as the radius of the ring, and that has a height of 0 (it will not be visible but acts as a gap). Place that rectangle on the left of the seed. Then pin that composition on its center_left, and rotate by the necessary amount.
Above is an example of a ring with 5 seeds, showing this approach. To make the rectangles visible, here they have a height of 1 instead of 0, and they are colored in red.
Create three rings of seeds:
Place them on top of a sliced pitaya without seeds.
This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.
Sliced Pitaya
PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version 1cd5229 (Tue, 05 Nov 2024 16:55:57 GMT)