38 lines
991 B
Markdown
Raw Normal View History

2016-03-25 16:47:20 -07:00
# Plot Frame
2016-04-01 16:22:47 -07:00
The plot frame function.
2016-03-25 16:47:20 -07:00
Display an [Image](/reference/images/image) on the @boardname@'s [LED screen](/device/screen)
2016-03-25 16:47:20 -07:00
## JavaScript
2016-03-25 16:47:20 -07:00
2016-08-09 16:55:43 +01:00
```sig
2016-03-25 16:47:20 -07:00
export function plotFrame(_this: micro_bit.Image, index: number)
```
## Parameters
2016-03-25 16:47:20 -07:00
2017-03-16 07:57:41 -07:00
* index - [Number](/types/number); which frame of the image to display
2016-03-25 16:47:20 -07:00
## Difference from `plot image`
2016-03-25 16:47:20 -07:00
The `plot frame` function takes the index of the frame (if there are two frames, then the possible indices are 0 and 1), whereas `plot image` accepts an offset (if there are two frames, the offset would range between 0 and 9).
## Example
2016-03-25 16:47:20 -07:00
2016-08-09 16:55:43 +01:00
```blocks
2016-03-25 16:47:20 -07:00
let img = images.createImage(`
# . . . # # . . . #
. # . # . . # # # .
. . # . . . # # # .
. # . # . . # # # .
# . . . # # . . . #
`)
img.plotFrame(1)
```
## See also
2016-03-25 16:47:20 -07:00
2016-04-15 15:02:26 -07: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-25 16:47:20 -07:00