pxt-calliope/docs/reference/images/show-frame.md

42 lines
1.1 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# Show Frame
2016-04-02 01:22:47 +02:00
The show frame function.
2016-03-26 00:47:20 +01:00
2016-04-16 00:02:26 +02:00
Display an [Image](/reference/images/image) on the BBC micro:bit's [LED screen](/device/screen)
2016-03-26 00:47:20 +01:00
2016-04-18 17:33:09 +02:00
### JavaScript
2016-03-26 00:47:20 +01:00
```
export function showFrame(img: micro_bit.Image, frame: number)
```
### Parameters
2016-04-13 17:27:45 +02:00
* index - [Number](/reference/types/number); which frame of the image to display
2016-03-26 00:47:20 +01:00
### Difference from `plot frame`
2016-04-13 17:27:45 +02:00
The `show frame` function is the same as [plot frame](/reference/image/plot-frame), but contains a built-in delay after the LED screen has been updated (whereas `plot frame` has no built-in delay)
2016-03-26 00:47:20 +01:00
### Example
```
let img = images.createImage(`
# . . . # # . . . #
. # . # . . # # # .
. . # . . . # # # .
. # . # . . # # # .
# . . . # # . . . #
`)
img.showFrame(1)
```
### Lessons
2016-04-13 17:27:45 +02:00
[smiley](/lessons/smiley), [flashing heart](/lessons/flashing-heart), [magic logo](/lessons/magic-logo)
2016-03-26 00:47:20 +01:00
### See also
2016-04-16 00:02:26 +02:00
[create image](/reference/images/create-image), [show animation](/reference/basic/show-animation), [image](/reference/images/image), [show image](/reference/images/show-image), [scroll image](/reference/images/scroll-image)
2016-03-26 00:47:20 +01:00