2.1.28, initiation update to PXT v5.28.24 (#54)
This commit is contained in:
committed by
Peli de Halleux
parent
38a964516e
commit
5c114a0c57
@@ -1,28 +1,27 @@
|
||||
# Set Pixel
|
||||
|
||||
The set pixel function. #set pixel.
|
||||
|
||||
Set the on/off state of pixel in an [Image](/reference/images/image).
|
||||
|
||||
### JavaScript
|
||||
## JavaScript
|
||||
|
||||
```sig
|
||||
export function setPixel(_this: micro_bit.Image, x: number, y: number, value: boolean)
|
||||
let item: Image = null;
|
||||
item.setPixel(0, 0, true)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* x - [Number](/reference/types/number); the *x coordinate* or horizontal position of a pixel in an [image](/reference/images/image)
|
||||
* x - [Number](/reference/types/number); the *y coordinate* or vertical position of a pixel in an [image](/reference/images/image)
|
||||
* x - [Number](/types/number); the *x coordinate* or horizontal position of a pixel in an [image](/reference/images/image)
|
||||
* y - [Number](/types/number); the *y coordinate* or vertical position of a pixel in an [image](/reference/images/image)
|
||||
* value -[Boolean](/blocks/logic/boolean); the on/off state of a pixel; `true` for on, `false` for off
|
||||
|
||||
### x, y coordinates?
|
||||
## x, y coordinates?
|
||||
|
||||
To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
The following example creates an image and stores it in the `img` variable. The `set pixel` function sets the centre pixel off, before `img` is shown using `show image`.
|
||||
The following example creates an image and stores it in the `img` variable. The `set pixel` function sets the center pixel off, before `img` is shown using `show image`.
|
||||
|
||||
```blocks
|
||||
let img = images.createImage(`
|
||||
@@ -35,8 +34,6 @@ let img = images.createImage(`
|
||||
img.setPixel(2, 2, false)
|
||||
img.showImage(0)
|
||||
```
|
||||
## See also
|
||||
|
||||
### See also
|
||||
|
||||
[pixel](/reference/images/pixel), [show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image)
|
||||
|
||||
[pixel](/reference/images/pixel), [show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image)
|
||||
Reference in New Issue
Block a user