Migrate docs from the other repo
This commit is contained in:
41
docs/reference/js/lessons/snowflake-fall/activity.md
Normal file
41
docs/reference/js/lessons/snowflake-fall/activity.md
Normal file
@ -0,0 +1,41 @@
|
||||
# snowflake fall activity
|
||||
|
||||
design a blinking rectangle animation. #docs #tutorials #stepByStep
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
### @video td/videos/snowflake-fall-0
|
||||
|
||||
Welcome! This tutorial will teach how design a **snowfall animation**. Let's get started!
|
||||
|
||||
### ~
|
||||
|
||||
Let's start by creating a `basic->forever` loop that will allow us to repeat the animation code. Any code in the `forever` loop will repeat in the background... forever.
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
}) // ***
|
||||
```
|
||||
|
||||
The next step is to add `basic->show animation` inside the `forever` loop to repeat an animation.
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
. . . . . . . . . .
|
||||
. . # . . . . . . .
|
||||
. # # # . . . . . .
|
||||
. . # . . . . . . .
|
||||
. . . . . . . . . .
|
||||
`, 400) // ***
|
||||
})
|
||||
```
|
||||
|
||||
Run your code in the simulator or download it to your BBC micro:bit to see what happens!
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
Excellent, you're ready to continue with the [challenges](/microbit/lessons/snowflake-fall/challenges)!
|
||||
|
||||
### ~
|
||||
|
64
docs/reference/js/lessons/snowflake-fall/challenges.md
Normal file
64
docs/reference/js/lessons/snowflake-fall/challenges.md
Normal file
@ -0,0 +1,64 @@
|
||||
# snowflake fall challenges
|
||||
|
||||
Coding challenges for the snowflake fall tutorial. #docs
|
||||
|
||||
## Before we get started
|
||||
|
||||
Complete the [snowflake fall](/microbit/lessons/snowflake-fall/activity) activity and your code will look like this:
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
. . . . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .
|
||||
. . . . .
|
||||
`, 400)
|
||||
})
|
||||
```
|
||||
|
||||
### Challenge 1
|
||||
|
||||
### @video td/videos/snowflake-fall-1
|
||||
|
||||
Let's begin creating our falling effect by adding another snowflake with `basic->show animation` that displays a different snowflake pattern after the first one. We need 2 frames in the new animation that display both the first and the second snowflake images.
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
. . . . . . . # . .
|
||||
. . # . . . # . # .
|
||||
. # # # . # . . . #
|
||||
. . # . . . # . # .
|
||||
. . . . . . . # . .
|
||||
`, 400) // ***
|
||||
})
|
||||
```
|
||||
|
||||
* Run your program to see the cool animation.
|
||||
|
||||
### Challenge 2
|
||||
|
||||
### @video td/videos/snowflake-fall-2
|
||||
|
||||
To finalize our snowflake fall, let's add a different snowflake pattern.
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
. . . . . . . # . . . # . # .
|
||||
. . # . . . # . # . # # . # #
|
||||
. # # # . # . . . # . . . . .
|
||||
. . # . . . # . # . # # . # #
|
||||
. . . . . . . # . . . # . # .
|
||||
`, 400) // ***
|
||||
})
|
||||
```
|
||||
|
||||
* Run your program and see if it works.
|
||||
|
||||
### Challenge 3
|
||||
|
||||
Add a fourth frame to the current animation... or make it your own!
|
||||
|
70
docs/reference/js/lessons/snowflake-fall/quiz-answer.md
Normal file
70
docs/reference/js/lessons/snowflake-fall/quiz-answer.md
Normal file
@ -0,0 +1,70 @@
|
||||
# snowflake fall quiz answers
|
||||
|
||||
create a snowflake fall animation #animation#forever #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [snowflake fall tutorial](/microbit/lessons/snowflake-fall/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. In reference to an animation, what is an "interval"?
|
||||
|
||||
The number of milliseconds to pause after each image frame.
|
||||
|
||||
## 2. Consider the following code
|
||||
|
||||
```
|
||||
basic.showAnimation(`
|
||||
. . . . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .
|
||||
. . . . .
|
||||
`, 400)
|
||||
```
|
||||
|
||||
What is the `interval` of the animation?
|
||||
|
||||
400
|
||||
|
||||
## 3. Consider the following image
|
||||
|
||||

|
||||
|
||||
Write the code to create a `forever` loop that shows an animation. Change the interval from 400 to 200 to make the animation go twice as fast!
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
. . . . . . . . . .
|
||||
. . # . . . . . . .
|
||||
. # # # . . . . . .
|
||||
. . # . . . . . . .
|
||||
. . . . . . . . . .
|
||||
`, 200)
|
||||
})
|
||||
```
|
||||
|
||||
## 4. Consider the following images
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Write the code to create a `forever` loop that shows an animation. Change the interval from 400 to 800 to make the animation go twice as slow!
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
. . . . . # # # # #
|
||||
. . # . . # # . # #
|
||||
. # # # . # . # . #
|
||||
. . # . . # # . # #
|
||||
. . . . . # # # # #
|
||||
`, 800)
|
||||
})
|
||||
```
|
||||
|
56
docs/reference/js/lessons/snowflake-fall/quiz-answers.md
Normal file
56
docs/reference/js/lessons/snowflake-fall/quiz-answers.md
Normal file
@ -0,0 +1,56 @@
|
||||
# snowflake fall quiz answers
|
||||
|
||||
create a snowflake fall animation #animation#forever #docs
|
||||
|
||||
This is the answer key for the [snowflake fall quiz](/microbit/lessons/snowflake-fall/quiz).
|
||||
|
||||
## 1. In reference to an animation, what is an "interval"?
|
||||
|
||||
The number of milliseconds to pause after each image frame.
|
||||
|
||||
## 2. What is the interval of the animation?
|
||||
|
||||
```
|
||||
basic.showAnimation(`
|
||||
. . . . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .
|
||||
. . . . .
|
||||
`, 400)
|
||||
```
|
||||
|
||||
## 3. Write the code to allow this animation to never stop displaying on the BBC micro:bit
|
||||
|
||||

|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
. . . . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .
|
||||
. . . . .
|
||||
`, 400)
|
||||
})
|
||||
```
|
||||
|
||||
## 4. Write the code to create a forever loop that shows an animation of these images. Change the interval from 400 to 800 to make the animation go twice as slow!
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
basic.showAnimation(`
|
||||
. . . . . # # # # #
|
||||
. . # . . # # . # #
|
||||
. # # # . # . # . #
|
||||
. . # . . # # . # #
|
||||
. . . . . # # # # #
|
||||
`, 800)
|
||||
})
|
||||
```
|
||||
|
42
docs/reference/js/lessons/snowflake-fall/quiz.md
Normal file
42
docs/reference/js/lessons/snowflake-fall/quiz.md
Normal file
@ -0,0 +1,42 @@
|
||||
# snowflake fall quiz
|
||||
|
||||
create a snowflake fall animation #animation#forever #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use the hints in the [snowflake fall activity](/microbit/lessons/snowflake-fall/activity) to answer this quiz!
|
||||
|
||||
## 1. In reference to an animation, what is an "interval"?
|
||||
|
||||
<br />
|
||||
|
||||
## 2. What is the interval of the animation?
|
||||
|
||||
```
|
||||
basic.showAnimation(`
|
||||
. . . . .
|
||||
. . # . .
|
||||
. # # # .
|
||||
. . # . .
|
||||
. . . . .
|
||||
`, 400)
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
## 3. How can we make this animation never stop displaying on the BBC micro:bit?
|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
||||
## 4. Write the code to create a forever loop that shows an animation of these images. Change the interval from 400 to 800 to make the animation go twice as slow!
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
<br/>
|
||||
|
Reference in New Issue
Block a user