Animating images

I created some simple images on my 16x32 pixel matrix using …drawLine, …drawPixel, etc. I used an Excel spreadsheet with a clipart overlay to get the pixels I wanted lit up. Worked not too bad.

Now I’m thinking of moving the images around, scroll left or right or up and down. Is there a simple algorithm to do this? Maybe an offset I can put in to move the image off the screen? Basically I want to scroll the image one way or the other. Each image takes about 20 lines to complete the display. (I try and draw rectangles first, then lines, then pixels).

Easiest way to do that is probably to add some x and y offsets to the pixels in your drawing code, and just clear the screen and redraw everything at the new position.

Alternatively, if you want to display an arbitrary image anywhere on the screen and you’re using Teensy 4.1, you could try this BitmapSprite library:

This reads .BMP files from the SD card and renders them at any (x, y) position. Images with transparency are supported, so you can render over a background.

Thanks that’s a good idea to add offsets to the pixels. I can visualize how that works in my head. I had been displaying bitmaps, using a 320x240 GLCD, converting them using GIMP. Worked okay, but for my display I never allowed for an SD memory card so may run out of memory in the Teensy. I could add a memory dongle that talks SPI I suppose.
I’ll check out that library. Good to know.

Yep, I wrote code for that

demo: