Rotate your device.
Turn off orientation lock in device settings.
Your browser is not supported. Please upgrade your browser to one of our supported browsers. You can try viewing the page, but expect functionality to be broken.
CS in Algebra curriculum and content is being deprecated. Within the next few months, this lab will no longer be available. Please check out Bootstrap: Algebra instead. Learn More.
Rotate your device.
Turn off orientation lock in device settings.
Let's get this moose dancing!
Drag out the
Measures are used to count time in music. In this tutorial, a measure is four beats long.
Version: 2019
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
Hour of Code | Dance Party: Events
I'm Aloe Blacc. I'm a singer, songwriter, and entertainer. I think computer science is really important to learn because computer science is the future, and I think it's important for people to be in control of the technology that is literally controlling their lives.
To make different dance moves happen at just the right time with the music, you can use something called events. An event tells your program to listen for something to happen and then react right away.
Some examples of events are listening for a mouse click, an arrow button, or a tap on the screen. The event we're going to use now will listen for a change in the song. The change will trigger your dancer to do a new dance.
Professional dancers practice their choreography by counting the beats of the song.
In music, a measure refers to a certain number of beats. In most popular songs, a measure is four beats long.
To get your dancers to let loose, you'll need a green event block. This event block says, "after 4 measures".
If you drag out a purple "do forever" block, you can pick a dance for your dancer to do. Because it's under the "after 4 measures" event block, your dancer will wait for four measures of the song before starting their dance.
Keep an eye on the measure counter at the top of the display area.
Look and listen for the event that will trigger the dance code. And right on cue, our dancer starts going.