arrow_back Color Picker (Part 2 of 2)
In this add-on, you will program a special rainbow button in the artist’s color palette.
The button uses a forever loop to constantly change the pen color, so, once the rainbow color is selected, it’s the only one that can be used to draw.
Start by selecting dot2, the costume tab, and the rainbow costume.
Next, select the scripts tab.
When this sprite is clicked, it should broadcast a new message.
Change the message that says "green" to "rainbow."
Then, click the pencil, and change the "when I receive" message to "rainbow."
Next, click the pen menu.
To make the pen appear like a rainbow, use a "change pen color by" block.
Every color in Scratch has a number value.
This block changes the colors based on those values.
Click the control menu, and place a forever loop around this block.
When this runs, it will constantly change the color of the pen.
Try it out now.
Click the flag and the rainbow sprite.
The pencil now draws as a rainbow! Tinker with the value in the "set pen color" block until you get an effect that you like.
Now it’s your turn: Select the rainbow costume in sprite 2.
Broadcast the message "rainbow" when the rainbow sprite is clicked.
Program the pen to constantly change colors using the "change pen color by" block and forever loop.