Merge pull request #307 from Microsoft/scrollimage

Fixing scrollImage to actually scroll
This commit is contained in:
Peli de Halleux 2016-11-17 04:44:44 -08:00 committed by GitHub
commit ecbf8409ea
2 changed files with 3 additions and 6 deletions

View File

@ -61,7 +61,7 @@ namespace ImageMethods {
/** /**
* Scrolls an image . * Scrolls an image .
* @param frameOffset x offset moved on each animation step, eg: 5, 1, -1 * @param frameOffset x offset moved on each animation step, eg: 1, 2, 5
* @param interval time between each animation step in milli seconds, eg: 200 * @param interval time between each animation step in milli seconds, eg: 200
*/ */
//% help=images/show-image weight=79 async blockNamespace=images //% help=images/show-image weight=79 async blockNamespace=images
@ -69,10 +69,7 @@ namespace ImageMethods {
//% parts="ledmatrix" //% parts="ledmatrix"
void scrollImage(Image id, int frameOffset, int interval) { void scrollImage(Image id, int frameOffset, int interval) {
MicroBitImage i(id); MicroBitImage i(id);
if (i.getWidth() <= 5) uBit.display.animate(i, interval, frameOffset, MICROBIT_DISPLAY_WIDTH - 1);
showImage(id, 0);
else
uBit.display.animate(i, interval, frameOffset, 0);
} }

View File

@ -53,7 +53,7 @@ declare interface Image {
/** /**
* Scrolls an image . * Scrolls an image .
* @param frameOffset x offset moved on each animation step, eg: 5, 1, -1 * @param frameOffset x offset moved on each animation step, eg: 1, 2, 5
* @param interval time between each animation step in milli seconds, eg: 200 * @param interval time between each animation step in milli seconds, eg: 200
*/ */
//% help=images/show-image weight=79 async blockNamespace=images //% help=images/show-image weight=79 async blockNamespace=images