Hide / disable a backgroundlayer properly

Hello,
I’m trying to build a score board…
My teensy 4.1 (+ SmartMatrix v5 + 128x32 matrix) collects an analog signal, which is the score.
I use an indexedlayer to display this score (eight digit).

A GIF appears (backgroundlayer) when a certain score is reached, but I would like to close / disable the GIF on the display after 10 seconds. (where the AnimatedGifs example only swaps the gif by another).

My code is able to stop the gif after 10 seconds, but I still have some LEDS flickering in the background where the GIF was.
Any idea to clear and clean the display properly ?

// default behavior is to play the gif for DISPLAY_TIME_SECONDS or for NUMBER_FULL_CYCLES, whichever comes first
    if((now - displayStartTime_millis) > (DISPLAY_TIME_SECONDS * 1000)){
        //openGifFilenameByIndex(GIF_DIRECTORY, 0);
        backgroundLayer.fillScreen({0,0,0});
        backgroundLayer.swapBuffers();
    }

Thanks

The code you wrote should clear the screen, but you also want to make sure you’re not trying to decode another frame of the GIF. Make sure you don’t end up calling decoder.decodeFrame() later on in your loop if you want the GIF to be stopped.

1 Like

Wow, support is really quick and accurate ! This fixes my problem
Thank you very much Louis !!