From 9305ee4596c1ba64be3203ed9d131e730d3fb4c7 Mon Sep 17 00:00:00 2001 From: David Mayes Date: Sun, 7 Aug 2022 15:41:26 -0700 Subject: [PATCH] Fix animation by clearing matrix canvas every frame --- examples-api-use/image-example.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/examples-api-use/image-example.cc b/examples-api-use/image-example.cc index 8788e78a6..09042b294 100644 --- a/examples-api-use/image-example.cc +++ b/examples-api-use/image-example.cc @@ -102,6 +102,7 @@ void ShowAnimatedImage(const ImageVector &images, RGBMatrix *matrix) { while (!interrupt_received) { for (const auto &image : images) { if (interrupt_received) break; + offscreen_canvas->Clear(); CopyImageToCanvas(image, offscreen_canvas); offscreen_canvas = matrix->SwapOnVSync(offscreen_canvas); usleep(image.animationDelay() * 10000); // 1/100s converted to usec