pxt-microbit Accessibility PR (#529)

* Accessibility changes
This commit is contained in:
Sam El-Husseini
2017-09-07 13:42:08 -07:00
committed by GitHub
parent 3f87576a50
commit e3975e65e5
357 changed files with 1641 additions and 3540 deletions

View File

@ -14,13 +14,13 @@ images.createBigImage(`
`);
```
### Parameters
## 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
## Example: Flip-flopping arrow
This program makes a big image with a picture of an arrow pointing up,
and an arrow pointing down. If you press button `A`, the program will
@ -44,7 +44,7 @@ input.onButtonPressed(Button.B, () => {
});
```
### See also
## See also
[image](/reference/images/image),
[create image](/reference/images/create-image),

View File

@ -13,12 +13,12 @@ images.createImage(`
`)
```
### Parameters
## 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
## 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
@ -45,7 +45,7 @@ input.onButtonPressed(Button.B, () => {
});
```
### See also
## See also
[image](/reference/images/image),
[create big image](/reference/images/create-big-image),

View File

@ -2,11 +2,11 @@
An image for the @boardname@ screen.
### @parent blocks/language
## @parent blocks/language
An *Image* is a matrix of pixels to show on the [LED screen](/device/screen)
### Block Editor: Show LEDs
## Block Editor: Show LEDs
To display an image:
@ -22,7 +22,7 @@ basic.showLeds(`
`)
```
### Creating an image
## Creating an image
To create an image that you can later modify, see the [create image](/reference/images/create-image) function.
@ -38,7 +38,7 @@ You should see code similar to this:
![](/static/mb/blocks/image-0.png)
### Image functions
## Image functions
* [create image](/reference/images/create-image): create an image from a series of on/off LED states
* [clear](/reference/basic/clear-screen): turn off all the pixels in an image
@ -47,7 +47,7 @@ You should see code similar to this:
* [show image](/reference/images/show-image): show an image on the screen
* [scroll image](/reference/images/scroll-image): scroll an image on the screen
### See also
## See also
[Show LEDs](/reference/basic/show-leds), [create image](/reference/images/create-image), [show image](/reference/images/show-image), [LED screen](/device/screen)

View File

@ -4,30 +4,30 @@ The pixel function.
Get the state of a pixel in an [Image](/reference/images/image).
### JavaScript
## JavaScript
```sig
export function pixel(_this: micro_bit.Image, x: number, y: number) : boolean
```
### Parameters
## Parameters
* 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)
### x, y coordinates?
## x, y coordinates?
To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
### Returns
## Returns
* [Boolean](/blocks/logic/boolean) - `true` for on and `false` for off
### Example
## Example
This example gets the state of pixel `0, 0` in the `img` variable:
### ~hide
## ~hide
```blocks
let img = images.createImage(`
@ -39,13 +39,13 @@ let img = images.createImage(`
`)
```
### ~
## ~
```typescript-ignore
let state = img.pixel(0, 0)
```
### See also
## See also
[set pixel](/reference/images/set-pixel), [show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image)

View File

@ -4,21 +4,21 @@ The plot frame function.
Display an [Image](/reference/images/image) on the @boardname@'s [LED screen](/device/screen)
### JavaScript
## JavaScript
```sig
export function plotFrame(_this: micro_bit.Image, index: number)
```
### Parameters
## Parameters
* index - [Number](/types/number); which frame of the image to display
### Difference from `plot image`
## Difference from `plot image`
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
## Example
```blocks
let img = images.createImage(`
@ -31,7 +31,7 @@ let img = images.createImage(`
img.plotFrame(1)
```
### See also
## See also
[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)

View File

@ -4,21 +4,21 @@ The plot image function.
Display an [Image](/reference/images/image) on the @boardname@'s [LED screen](/device/screen)
### JavaScript
## JavaScript
```sig
export function plotImage(_this: micro_bit.Image, xOffset: number)
```
### Parameters
## Parameters
* x offset - [Number](/types/number); the horizontal starting point of an image; use 0 for the first frame of the image, 5 for the second frame of the image, 10 for the third frame and so on.
### Difference from `show image`
## Difference from `show image`
The `show image` function has a built in delay of 400ms after display of the image, whereas `plot image` has no built-in delay.
### Example
## Example
```blocks
let img = images.createImage(`
@ -31,7 +31,7 @@ let img = images.createImage(`
img.plotImage(0)
```
### See also
## See also
[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)

View File

@ -8,7 +8,7 @@ let item: Image = null;
item.scrollImage(5, 200);
```
### Parameters
## Parameters
* a [number](/types/number) that means
how many LEDs to scroll at a time, from right to left or
@ -25,7 +25,7 @@ item.scrollImage(5, 200);
``offset`` says. (1000 milliseconds is one second.) The bigger you
make this number, the slower the image will scroll.
### Example
## Example
This program scrolls an image of two arrows five LEDs at a time,
with a pause of 200 milliseconds between each time it scrolls.
@ -47,7 +47,7 @@ basic.forever(() => {
});
```
### See also
## See also
[show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [show animation](/reference/basic/show-animation)

View File

@ -4,23 +4,23 @@ 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)
```
### Parameters
## Parameters
* x - [Number](/types/number); the *x coordinate* or horizontal position of a pixel in an [image](/reference/images/image)
* x - [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`.
@ -36,7 +36,7 @@ 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)

View File

@ -4,21 +4,21 @@ The show frame function.
Display an [Image](/reference/images/image) on the @boardname@'s [LED screen](/device/screen)
### JavaScript
## JavaScript
```sig
export function showFrame(img: micro_bit.Image, frame: number)
```
### Parameters
## Parameters
* index - [Number](/types/number); which frame of the image to display
### Difference from `plot frame`
## Difference from `plot frame`
The `show frame` function is the same as [plot frame](/reference/images/plot-frame), but contains a built-in delay after the LED screen has been updated (whereas `plot frame` has no built-in delay)
### Example
## Example
```blocks
let img = images.createImage(`
@ -31,7 +31,7 @@ let img = images.createImage(`
img.showFrame(1)
```
### See also
## See also
[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)

View File

@ -9,12 +9,12 @@ let item: Image = null;
item.showImage(0);
```
### Parameters
## Parameters
* an [image](/reference/images/image) (picture). It is usually a square with five LEDs on a side, but it might be wider.
* a [number](/types/number) that says how many LEDs from the left of the picture the @boardname@ should start. `0` means start at the first **frame** of the picture, `5` means start at the second frame, `10` means start at the third, and so on.
### Example: Flip-flopping arrow
## Example: Flip-flopping arrow
This program makes a big image with a frame of an arrow pointing up,
and a frame of an arrow pointing down. If you press button `A`, the
@ -39,7 +39,7 @@ input.onButtonPressed(Button.B, () => {
});
```
### See also
## See also
[image](/reference/images/image),
[create image](/reference/images/create-image),

View File

@ -8,17 +8,17 @@ Get the width of an [Image](/reference/images/image) in columns.
images.createImage().width();
```
### Parameters
## Parameters
* none
### Returns
## Returns
* [Number](/types/number) - the number of columns in a image. This function returns 5 if the image has 1 frame, 10 for 2 frames, 15 for 3 frames and so on. Divide the number of columns by 5 to find out how many frames an image has (see example below).
The following example gets the width of `img` and stores it in the `w` variable:
### ~hide
## ~hide
```blocks
let img = images.createImage(`
@ -30,13 +30,13 @@ let img = images.createImage(`
`)
```
### ~
## ~
```typescript-ignore
let w = img.width()
```
### Example: show each frame
## Example: show each frame
The following example uses the `width` function with a [for](/blocks/loops/for) loop to show each image frame on the screen:
@ -54,7 +54,7 @@ for (let i = 0; i < img2.width() / 5; i++) {
}
```
### See also
## See also
[show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)