pxt-calliope/docs/reference/images/create-image.md
Juri Wolf 5f7a8e5301
Updates for V4 (#197)
* update yotta defaults for 16kb devices

* refactor deprecated blocks

* updates for button events

* update button events

* update refference

* update docs

* update docs

* update button event blocks

* update docs

* update block id
2022-08-10 09:36:19 -07:00

55 lines
1.2 KiB
Markdown

# Create Image
Make an [image](/reference/images/image) (picture) for the @boardname@
[LED screen](/device/screen).
```sig
images.createImage(`
. . # . .
. # # # .
# # # # #
. # # # .
. . # . .
`)
```
## Parameters
* ``leds`` is a [string](/types/string) that says which LEDs
on the screen should be on and which should be off.
## Example: Flip-flopping arrow
If you press button `A`, this program will make a picture of an
arrow and show it on the LED screen. If you press button `B`, the
program will show a picture of the arrow upside-down.
```blocks
input.onButtonEvent(Button.A, input.buttonEventClick(), () => {
images.createImage(`
. . # . .
. # # # .
# . # . #
. . # . .
. . # . .
`).showImage(0);
});
input.onButtonEvent(Button.B, input.buttonEventClick(), () => {
images.createImage(`
. . # . .
. . # . .
# . # . #
. # # # .
. . # . .
`).showImage(0);
});
```
## See also
[image](/reference/images/image),
[create big image](/reference/images/create-big-image),
[show image](/reference/images/show-image),
[scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)