pxt-calliope/docs/lessons/snowflake-fall/activity.md

64 lines
1.2 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# snowflake fall blocks activity
2016-04-02 01:22:47 +02:00
design a blinking rectangle animation.
2016-03-26 00:47:20 +01:00
## ~avatar avatar
2016-03-26 00:47:20 +01:00
2016-05-27 00:24:10 +02:00
2016-03-26 00:47:20 +01:00
Welcome! This tutorial will teach how design a **snowfall animation**. Let's get started!
## ~
2016-03-26 00:47:20 +01:00
Let's start by creating a `forever` loop that will allow us to repeat the show LEDs code. Any code in the `forever` loop will repeat in the background... forever.
```blocks
basic.forever(() => {
basic.showLeds(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
})
```
The next step is to add two `show LEDs` blocks inside the `forever` loop to repeat an animation.
```blocks
basic.forever(() => {
basic.showLeds(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`)
basic.showLeds(`
. . # . .
. # . # .
# . . . #
. # . # .
. . # . .
`)
})
2016-03-31 00:11:05 +02:00
```
2016-03-26 00:47:20 +01:00
Run your code in the simulator or download it to your @boardname@ to see what happens!
2016-03-26 00:47:20 +01:00
## ~avatar avatar
2016-03-26 00:47:20 +01:00
2016-04-13 17:27:45 +02:00
Excellent, you're ready to continue with the [challenges](/lessons/snowflake-fall/challenges)!
2016-03-26 00:47:20 +01:00
## ~
2016-03-26 00:47:20 +01:00