2.1.28, initiation update to PXT v5.28.24 (#54)

This commit is contained in:
Amerlander
2019-12-02 05:58:26 +01:00
committed by Peli de Halleux
parent 38a964516e
commit 5c114a0c57
1261 changed files with 50692 additions and 21604 deletions

View File

@@ -8,17 +8,13 @@ Get the width of an [Image](/reference/images/image) in columns.
images.createImage().width();
```
### Parameters
## Returns
* none
### Returns
* [Number](/reference/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).
* [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 +26,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 +50,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)