At My Fingertips
Rapid Playground
Your challenge: compose a flower with rainbow-colored leaves.
The function hsl_color is a great way to create all the colors of a rainbow.
Each leaf of your flower should have a different color. The tone of the color conveniently corresponds to the angle of the leaf: 0 is red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, and 300 is magenta.
Tip: If you use a semi-transparent color (opacity around 0.5) the leaves will be partially see-through, and you will be able to see the underlying leaves.
Implement the given function leaf
. Pin the leaf center-left and rotate it by the given angle.
Implement the flower
function so that it constructs a 12-leaved colorful flower.
Use the function leaf
to construct the leaves.
Use the function compose to compose two leaves into one graphic.
The function empty_graphic can help to reduce an arbitrary number of leaves into a single graphic.
Which colors do you get when you construct a flower with only 3 leaves?
Can you construct a flower with 3 leaves with angles (not starting with 0 degrees) such that the leaves are yellow
, cyan
, and magenta
?
What happens if you construct a flower with 360 leaves?
This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.
Color Flower
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)