moving out outdated js docs

This commit is contained in:
Peli de Halleux
2016-04-15 14:37:25 -07:00
parent 6515cc0360
commit bb6ae00a49
153 changed files with 0 additions and 81 deletions

View File

@ -0,0 +1,47 @@
# screen wipe activity
Clear the screen by pressing buttons on the BBC micro:bit.
### ~avatar avatar
### @video td/videos/screen-wipe-0
This activity will teach how to clear the screen by pressing button ``A`` on the BBC micro:bit.
### ~
You can use the `basic->clear screen` function to turn off all the LED on the screen. Let's illustrate this concept with a small script where the user has to press the button ``A`` to turn off the screen. Let's start by adding the code to show an animation.
```
basic.showAnimation(`
# # # # # # # # # # . . . . . . . . . .
# # # # # # # # # # . . . . . . . . . .
. . . . . # # # # # # # # # # . . . . .
. . . . . # # # # # # # # # # # # # # #
. . . . . . . . . . . . . . . # # # # #
`, 400) // ***
```
We add another line of code that registers an **event handler** on the `input->on button pressed(A)` and calls `basic->clear screen`.
```
basic.showAnimation(`
# # # # # # # # # # . . . . . . . . . .
# # # # # # # # # # . . . . . . . . . .
. . . . . # # # # # # # # # # . . . . .
. . . . . # # # # # # # # # # # # # # #
. . . . . . . . . . . . . . . # # # # #
`, 400)
input.onButtonPressed(Button.A, () => {
basic.clearScreen() // ***
}) // ***
```
Run the script in the simulator or on the BBC micro:bit to see how this works!
### ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/screen-wipe/challenges)!
### ~

View File

@ -0,0 +1,73 @@
# screen wipe challenges
Coding challenges for the screen wipe tutorial. #docs
## Before we get started
Complete the [screen wipe](/lessons/screen-wipe) activity and your code will look like this:
```
basic.showAnimation(`
# # # # # # # # # # . . . . . . . . . .
# # # # # # # # # # . . . . . . . . . .
. . . . . # # # # # # # # # # . . . . .
. . . . . # # # # # # # # # # # # # # #
. . . . . . . . . . . . . . . # # # # #
`, 400)
input.onButtonPressed(Button.A, () => {
basic.clearScreen()
})
```
**Challenge 1**
Create an event handler for Button "B".
```
basic.showAnimation(`
# # # # # # # # # # . . . . . . . . . .
# # # # # # # # # # . . . . . . . . . .
. . . . . # # # # # # # # # # . . . . .
. . . . . # # # # # # # # # # # # # # #
. . . . . . . . . . . . . . . # # # # #
`, 400)
input.onButtonPressed(Button.A, () => {
basic.clearScreen()
})
input.onButtonPressed(Button.B, () => {
})
```
**Challenge 2**
### @video td/videos/screen-wipe-2
Replay the animation when the "B" button is pressed by typing in `basic->show animation(..., 400)`.
```
basic.showAnimation(`
# # # # # # # # # # . . . . . . . . . .
# # # # # # # # # # . . . . . . . . . .
. . . . . # # # # # # # # # # . . . . .
. . . . . # # # # # # # # # # # # # # #
. . . . . . . . . . . . . . . # # # # #
`, 400)
input.onButtonPressed(Button.A, () => {
basic.clearScreen()
})
input.onButtonPressed(Button.B, () => {
basic.showAnimation(`
# # # # # # # # # # . . . . . . . . . .
# # # # # # # # # # . . . . . . . . . .
. . . . . # # # # # # # # # # . . . . .
. . . . . # # # # # # # # # # # # # # #
. . . . . . . . . . . . . . . # # # # #
`, 400) // ***
})
```
**Challenge 3**
Show an animation that scrolls back up when you press button "B".
* tap the `run` button to view your final product!

View File

@ -0,0 +1,45 @@
# screen wipe quiz answers
clear the screen by pressing the "A" button after an animation has been played.
This is the answer key for the [screen wipe quiz](/lessons/screen-wipe/quiz).
## 1. What does the function "clear screen" do on the BBC micro:bit?
This function turns off all the LED lights on the LED screen.
## 2. Write the line of code that creates and displays this animation.
![](/static/mb/lessons/screen-wipe-0.png)
<br/>
```
basic.showAnimation(`
# # # # . # # # # # . . . . . . . . . .
# # # # # # # # # # . . . . . . . . . .
. . . . . # # # # # # # # # # . . . . .
. . . . . # # # # # # # # # # # # # # #
. . . . . . . . . . . . . . . # # # # #
`, 400)
```
## 3. Write the condition that will detect when the BBC micro:bit is shaken.
<br/>
```
input.onGesture(Gesture.Shake, () => {
})
```
## 4. Write the code that will clear an animation from the screen after shaking the BBC micro:bit.
<br/>
```
input.onGesture(Gesture.Shake, () => {
basic.clearScreen()
})
```

View File

@ -0,0 +1,32 @@
# screen wipe quiz
clear the screen by pressing the "A" button after an animation has been played.
## Name
## Directions
Use this activity document to guide your work in the [screen wipe tutorial](/lessons/screen-wipe/tutorial)
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What does the function "clear screen" do on the BBC micro:bit?
<br/>
## 2. We can show all of these images in one line of code. What method can we use to do this?
![](/static/mb/lessons/screen-wipe-0.png)
<br/>
## 3. How can the BBC micro:bit detect when it is shaken?
<br/>
<br/>
## 4. Write the code that will clear an animation from the screen after shaking the BBC micro:bit.
<br/>