Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this add on you will add a stage backdrop
with sweet color changing lights.
To set the scene for your music mix.
[Computer Program] Ya!
To get started select the stage
and add the stage backdrops from the backdrop library.
To create the light show effect go to the looks menu
and drop out the change color effect by 25 block.
If you click it multiple times, you will see that the color
of the backdrop and the lights change.
Pretty cool, right?
To make the backdrop change continuously,
select the forever loop from the control menu
and place it around the change color effect block.
Test the code now.
It works but the lights are moving really, really fast.
To control the speed of the light show,
use a a wait block and create a variable to control
how long the program waits before changing the color effect.
Drag out a wait one second block
and connect it to the change color effect by block.
Go to the variable menu
and click make a variable.
Name it light speed.
The new variable should show up in the variable menu
and on your stage.
Turn the variable into a slider bar on your stage
by double clicking on it twice.
From the green operator menu drag out a division operator
and insert it into the wait block.
In the numerator or top half of the operator block
insert the variable light speed from the variable menu.
Then change the white value field in the denominator to 100.
Test your code by clicking on the block stack
than adjusting the slider.
The the light show should speed up
as you slide it to the left
and slow down as you slide it to the right.
Finally, add an event block to start your light show.
This example tells the computer to start the light show
when the L key is pressed.
To make that happen, go to the events menu,
select a when key pressed event block
and connect it to the top of the block stack.
Change the key in the drop down menu to "L"
or to any key you want to press to run the code.
Test the code by clicking the green flag
and pressing the key that starts the light show.
<v ->[Computer Program] Ya! (soft upbeat music)</v>
(soft upbeat music)
Ya! (soft upbeat music)
Now it's your turn.
Select the stage and add the stage backdrop
from the backdrop library to your project.
Add a change color effect by 25 block
and set the value to something you like.
Place a forever loop around the change color effect block.
Add a wait block inside the forever loop.
Create a variable called light speed
and turn it into a slider bar.
And lastly, set the value of the wait block
using the division operator block
and the light speed variable.