pxt-calliope/docs/lessons/rotation-animation/quiz.md

84 lines
1.4 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# rotation animation quiz
2016-04-02 01:22:47 +02:00
Learn how to create a rotating image with a while loop.
2016-03-26 00:47:20 +01:00
## Name
## Directions
2016-04-13 17:27:45 +02:00
Use this activity document to guide your work in the [rotation animation tutorial](/lessons/rotation-animation/activity).
2016-03-26 00:47:20 +01:00
Answer the questions while completing the tutorial. Pay attention to the dialogues!
2016-03-31 00:11:05 +02:00
## 1. What is a " variable"?
2016-03-26 00:47:20 +01:00
<br />
2016-03-31 00:11:05 +02:00
## 2. Write the code to create a variable called foo that stores a boolean and initialize it to false.
2016-03-26 00:47:20 +01:00
<br/>
2016-03-31 00:11:05 +02:00
## 3. Explain why you use a while loop with a variable
2016-03-26 00:47:20 +01:00
2016-03-31 00:11:05 +02:00
```blocks
let rotating = true;
2016-03-26 00:47:20 +01:00
while (rotating) {
2016-03-31 00:11:05 +02:00
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
2016-03-26 00:47:20 +01:00
}
2016-03-31 00:11:05 +02:00
2016-03-26 00:47:20 +01:00
```
<br/>
## 4. Draw the areas on the micro:bits to illustrate the code below. Explain why you chose to draw in those areas.
2016-03-31 00:11:05 +02:00
```blocks
2016-03-31 01:10:27 +02:00
basic.showLeds(`
. . # . .
. . # . .
. . # . .
. . # . .
. . # . .
`)
basic.showLeds(`
. . . . .
. . . . .
# # # # #
. . . . .
. . . . .
`)
basic.showLeds(`
. . . . #
. . . # .
. . # . .
. # . . .
# . . . .
`)
basic.showLeds(`
. . . . #
. . . # .
. . # . .
. # . . .
# . . . .
`)
2016-03-26 00:47:20 +01:00
```
![](/static/mb/lessons/looper-2.png)
<br/>