Migrate docs from the other repo
This commit is contained in:
68
docs/reference/js/lessons/rotating-animation/challenges.md
Normal file
68
docs/reference/js/lessons/rotating-animation/challenges.md
Normal file
@ -0,0 +1,68 @@
|
||||
# rotation animation challenges
|
||||
|
||||
These challenges take the rotation animation to the next level by adding a while loop and changing a boolean to false. #docs
|
||||
|
||||
**Challenge 0**
|
||||
|
||||
### @video vimeo/134323475
|
||||
|
||||
The [Rotating Pattern tutorial](https://test.microbit.co.uk/td/lessons/rotation-animation/tutorial) will help you create images that look like a rotating pattern by using a while loop.
|
||||
|
||||
```
|
||||
rotating = true
|
||||
while (rotating) {
|
||||
basic.showAnimation(`
|
||||
# . . . . . . # . . . . . . # . . . . .
|
||||
. # . . . . . # . . . . . # . . . . . .
|
||||
. . # . . . . # . . . . # . . # # # # #
|
||||
. . . # . . . # . . . # . . . . . . . .
|
||||
. . . . # . . # . . # . . . . . . . . .
|
||||
`, 400)
|
||||
}
|
||||
```
|
||||
|
||||
**Challenge 1**
|
||||
|
||||
Now let's add to this by creating a condition for on button pressed `A` before the while loop.
|
||||
|
||||
```
|
||||
rotating = true
|
||||
input.onButtonPressed("A", () => {
|
||||
}) // ***
|
||||
while (rotating) {
|
||||
basic.showAnimation(`
|
||||
# . . . . . . # . . . . . . # . . . . .
|
||||
. # . . . . . # . . . . . # . . . . . .
|
||||
. . # . . . . # . . . . # . . # # # # #
|
||||
. . . # . . . # . . . # . . . . . . . .
|
||||
. . . . # . . # . . # . . . . . . . . .
|
||||
`, 400)
|
||||
}
|
||||
```
|
||||
|
||||
**Challenge 2**
|
||||
|
||||
### @video vimeo/134323896
|
||||
|
||||
Now that we have the on button pressed condition, let's make the animation stop rotating by setting the rotating global variable to false when button `A` is pressed.
|
||||
|
||||
```
|
||||
rotating = true
|
||||
input.onButtonPressed("A", () => {
|
||||
rotating = false // ***
|
||||
}) // ***
|
||||
while (rotating) {
|
||||
basic.showAnimation(`
|
||||
# . . . . . . # . . . . . . # . . . . .
|
||||
. # . . . . . # . . . . . # . . . . . .
|
||||
. . # . . . . # . . . . # . . # # # # #
|
||||
. . . # . . . # . . . # . . . . . . . .
|
||||
. . . . # . . # . . # . . . . . . . . .
|
||||
`, 400)
|
||||
}
|
||||
```
|
||||
|
||||
**Challenge 3**
|
||||
|
||||
Let's also make the image rotate the opposite way when button A is pressed! We can do this with another while loop that is only executed when `rotating->equals(false)`.
|
||||
|
99
docs/reference/js/lessons/rotating-animation/lesson-plan.md
Normal file
99
docs/reference/js/lessons/rotating-animation/lesson-plan.md
Normal file
@ -0,0 +1,99 @@
|
||||
# rotating animation lesson plan
|
||||
|
||||
Learn how to create images with a global variable and while loop. #LED #screen #plot #docs
|
||||
|
||||
### @video vimeo/134323475
|
||||
|
||||
## Topic
|
||||
|
||||
While Loop - Rotating Animations
|
||||
|
||||
## Class
|
||||
|
||||
Year 7
|
||||
|
||||
## Prior learning/place of lesson in scheme of work
|
||||
|
||||
Learn how to create images that look like a rotating animation by using a while loop. We will be learning how to create a rotating animation using a global variable, while loop as well as simple commands, such as on button pressed and show animation.
|
||||
|
||||
## What the teacher needs to know
|
||||
|
||||
**Program:** A stored set of instructions encoded in a language understood by the computer that does some form of computation, processing input and/or stored data to generate output.**
|
||||
|
||||
**Algorithm:** An unambiguous set of rules or a precise step-by-step guide to solve a problem or achieve a particular objective. The guided tutorial follows a algorithm and is a precise step-by-step guide to solve a problem**
|
||||
|
||||
**Loop:** A block of code repeated automatically under the program’s control. ** The blink program introduces Forever. Forever will repeats code in the background forever.
|
||||
|
||||
**Command:** An instruction for the computer to execute, written in a particular programming language.**
|
||||
|
||||
**QuickStart Computing Glossary
|
||||
|
||||
## Documentation
|
||||
|
||||
* **global variables**: [read more...](/microbit/functions/data)
|
||||
* **pause**: [read more...](/microbit/reference/basic/pause)
|
||||
* **forever**: [read more...](/microbit/reference/basic/forever)
|
||||
|
||||
## Resources
|
||||
|
||||
* Activity: [tutorial](/microbit/lessons/rotating-pattern/tutorial)
|
||||
* Activity: [quiz](/microbit/lessons/rotating-animation/quiz)
|
||||
* Extended Activity: [challenges](/microbit/lessons/rotating-animation/challenges)
|
||||
|
||||
## Objectives
|
||||
|
||||
* learn how to create a global variable
|
||||
* learn how a rotating animation
|
||||
* learn how to repeat the animation
|
||||
|
||||
## Links to the National Curriculum Programmes of Study for Computing
|
||||
|
||||
## Assessment
|
||||
|
||||
### Progression Pathways
|
||||
|
||||
### Computational Thinking Framework
|
||||
|
||||
#### Algorithms
|
||||
|
||||
* Understands that iteration is the repetition of a process such as a loop. (AL)
|
||||
* Represents solutions using a structured notation. (AL) (AB)
|
||||
|
||||
#### Programming & Development
|
||||
|
||||
* Creates programs that implement algorithms to achieve given goals. (AL)
|
||||
* Declares and assigns variables.(AB)
|
||||
|
||||
#### Data & Data Representation
|
||||
|
||||
* Understands the difference between data and information. (AB)
|
||||
* Defines data types: real numbers and Boolean. (AB)
|
||||
|
||||
#### Information Technology
|
||||
|
||||
* Collects, organises and presents data and information in digital content. (AB)
|
||||
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution. (EV)
|
||||
|
||||
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
|
||||
|
||||
## Activity
|
||||
|
||||
* time: 20 min.
|
||||
* [tutorial](/microbit/lessons/rotating-animation/tutorial)
|
||||
* [quiz](/microbit/lessons/rotating-animation/quiz)
|
||||
* assessment opportunities: forever, plot, pause, clear screen
|
||||
|
||||
## Extended Activity
|
||||
|
||||
* time: 20 min.
|
||||
* [challenges](/microbit/lessons/rotating-animation/challenges)
|
||||
* assessment opportunities: loops, plot, pause, clear screen
|
||||
|
||||
## Homework
|
||||
|
||||
* Extended Activity: [challenges](/microbit/lessons/rotating-animation/challenges)
|
||||
|
||||
## Intended follow on
|
||||
|
||||
Publish script to the classroom.
|
||||
|
77
docs/reference/js/lessons/rotating-animation/quiz.md
Normal file
77
docs/reference/js/lessons/rotating-animation/quiz.md
Normal file
@ -0,0 +1,77 @@
|
||||
# rotating animation quiz
|
||||
|
||||
Learn how to create a rotating image with a while loop. #image #loop #while #docs
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [rotating animation tutorial](/microbit/js/tutorials/rotating-animation).
|
||||
|
||||
Answer the questions below while working on or after you finish the tutorial. Pay attention to the dialogs!
|
||||
|
||||
## 1. What is a while loop?
|
||||
|
||||
## 2. Consider the following directions
|
||||
|
||||
Write the code to create a **global variable** called `rotating` and initialize it to **true**.
|
||||
|
||||
## 3. Consider the following directions
|
||||
|
||||
Write the code to create a **while** loop that will be executed only if the **global variable** called `rotating` is **true**.
|
||||
|
||||
## 4. Consider the following code
|
||||
|
||||
```
|
||||
basic.showAnimation(`
|
||||
# . . . . . . # . . . . . . # . . . . .
|
||||
. # . . . . . # . . . . . # . . . . . .
|
||||
. . # . . . . # . . . . # . . # # # # #
|
||||
. . . # . . . # . . . # . . . . . . . .
|
||||
. . . . # . . # . . # . . . . . . . . .
|
||||
`, 400)
|
||||
```
|
||||
|
||||
If the rectangles below represents a board that is 5 LEDs wide and 5 LEDs tall, place an X approximately where the LED is lighted in the series. Explain why the LED is lighted there.
|
||||
|
||||

|
||||
|
||||
******************************
|
||||
|
||||
## ANSWER KEY
|
||||
|
||||
## Directions
|
||||
|
||||
Answer the questions below while working on or after you finish the tutorial.
|
||||
|
||||
## 2. Consider the following directions
|
||||
|
||||
Write the line of code to create a **global variable** called `rotating` and initialize it to **true**.
|
||||
|
||||
```
|
||||
rotating = true
|
||||
```
|
||||
|
||||
## 3. Consider the following directions
|
||||
|
||||
Write the line of code that create a **while** loop that will be executed only if the **global variable** called `rotating` is **true**.
|
||||
|
||||
```
|
||||
while (rotating) {
|
||||
}
|
||||
```
|
||||
|
||||
## 4. Consider the following code
|
||||
|
||||
```
|
||||
basic.showAnimation(`
|
||||
# . . . . . . # . . . . . . # . . . . .
|
||||
. # . . . . . # . . . . . # . . . . . .
|
||||
. . # . . . . # . . . . # . . # # # # #
|
||||
. . . # . . . # . . . # . . . . . . . .
|
||||
. . . . # . . # . . # . . . . . . . . .
|
||||
`, 400)
|
||||
```
|
||||
|
||||
If the rectangles below represents a board that is 5 LEDs wide and 5 LEDs tall, place an X approximately where the LED is lighted in the series. Explain why the LED is lighted there.
|
||||
|
Reference in New Issue
Block a user