Showimagedelay (#446)

* add delay on "show image"

* removing optional duration
This commit is contained in:
Peli de Halleux 2018-04-05 20:42:03 -07:00 committed by GitHub
parent 29f081eb03
commit fbb3280bc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -31,7 +31,7 @@ namespace brick {
*/
show() {
brick.setStatusLight(this.light);
brick.showImage(this.image);
brick.showImage(this.image, 0);
music.playSoundEffectUntilDone(this.sound);
pause(20);
}

View File

@ -91,13 +91,17 @@ namespace brick {
/**
* Show an image on the screen
* @param image image to draw
* @param duration duration in milliseconds to display the image, eg: 400
*/
//% blockId=screen_show_image block="show image %image=screen_image_picker"
//% weight=100 group="Screen" blockGap=8
//% help=brick/show-image
export function showImage(image: Image) {
export function showImage(image: Image, duration: number = 400) {
if (!image) return;
screen.drawImage(image, 0, 0)
screen.fill(0);
screen.drawImage(image, 0, 0);
if (duration > 0)
pause(duration);
}
/**