pxt-calliope/docs/lessons/rotation-animation/quiz.md
2016-11-01 17:44:37 -07:00

1.4 KiB

rotation animation quiz

Learn how to create a rotating image with a while loop.

Name

Directions

Use this activity document to guide your work in the rotation animation tutorial.

Answer the questions while completing the tutorial. Pay attention to the dialogues!

1. What is a " variable"?


2. Write the code to create a variable called foo that stores a boolean and initialize it to false.


3. Explain why you use a while loop with a variable

let rotating = true;
while (rotating) {
    basic.showLeds(`
        . . . . .
        . . . . .
        . . # . .
        . . . . .
        . . . . .
        `)
    basic.showLeds(`
        . . . . .
        . . . . .
        . . . . .
        . . . . .
        . . . . .
        `)
}


4. Draw the areas on the @boardname@s to illustrate the code below. Explain why you chose to draw in those areas.

basic.showLeds(`
        . . # . .
        . . # . .
        . . # . .
        . . # . .
        . . # . .
        `)
basic.showLeds(`
        . . . . .
        . . . . .
        # # # # #
        . . . . .
        . . . . .
        `)
basic.showLeds(`
        . . . . #
        . . . # .
        . . # . .
        . # . . .
        # . . . .
        `)
basic.showLeds(`
        . . . . #
        . . . # .
        . . # . .
        . # . . .
        # . . . .
        `)