Showimagedelay (#446)
* add delay on "show image" * removing optional duration
This commit is contained in:
parent
29f081eb03
commit
fbb3280bc8
@ -31,7 +31,7 @@ namespace brick {
|
|||||||
*/
|
*/
|
||||||
show() {
|
show() {
|
||||||
brick.setStatusLight(this.light);
|
brick.setStatusLight(this.light);
|
||||||
brick.showImage(this.image);
|
brick.showImage(this.image, 0);
|
||||||
music.playSoundEffectUntilDone(this.sound);
|
music.playSoundEffectUntilDone(this.sound);
|
||||||
pause(20);
|
pause(20);
|
||||||
}
|
}
|
||||||
|
@ -91,13 +91,17 @@ namespace brick {
|
|||||||
/**
|
/**
|
||||||
* Show an image on the screen
|
* Show an image on the screen
|
||||||
* @param image image to draw
|
* @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"
|
//% blockId=screen_show_image block="show image %image=screen_image_picker"
|
||||||
//% weight=100 group="Screen" blockGap=8
|
//% weight=100 group="Screen" blockGap=8
|
||||||
//% help=brick/show-image
|
//% help=brick/show-image
|
||||||
export function showImage(image: Image) {
|
export function showImage(image: Image, duration: number = 400) {
|
||||||
if (!image) return;
|
if (!image) return;
|
||||||
screen.drawImage(image, 0, 0)
|
screen.fill(0);
|
||||||
|
screen.drawImage(image, 0, 0);
|
||||||
|
if (duration > 0)
|
||||||
|
pause(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user