Migrate docs from the other repo
This commit is contained in:
39
docs/reference/game/clear.md
Normal file
39
docs/reference/game/clear.md
Normal file
@ -0,0 +1,39 @@
|
||||
# Clear
|
||||
|
||||
The clear function for images. #clear #docs
|
||||
|
||||
Turn off all the pixels in an [Image](/microbit/reference/image/image).
|
||||
|
||||
### KindScript
|
||||
|
||||
```
|
||||
export function clear(img: micro_bit.Image)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* none
|
||||
|
||||
### Example
|
||||
|
||||
The following example turns off the pixels of `img` when the A input button is pressed:
|
||||
|
||||
```
|
||||
let img = images.createImage(`
|
||||
. . . . .
|
||||
. # # # .
|
||||
. # # # .
|
||||
. # # # .
|
||||
. . . . .
|
||||
`)
|
||||
img.showImage(0)
|
||||
input.onButtonPressed("A", () => {
|
||||
img.clear()
|
||||
img.showImage(0)
|
||||
})
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
[Image](/microbit/reference/image/image), [show animation](/microbit/reference/basic/show-animation), [show image](/microbit/reference/images/show-image), [scroll image](/microbit/reference/images/scroll-image), [create image](/microbit/reference/images/create-image)
|
||||
|
Reference in New Issue
Block a user