Animation load from sd card

General

BlinkyShay

6 months ago

Hi!
Is there any way to load png pictures from sd card and make from them animation? 

I made this animation for standing :

And I want to make different kinds of armor.
But making single function with animation for every kind of armor seems bad.

So can I import png pictures to this funtions?

const uint8_t myAnimBuf[] = 
{  8, 8,   0x2A, 0x00, 1,  0xFF, // no transparency  1, 
  /* frames i want to import from sd card */
};

Or is there another way to make animations with files load from sd?


Sorunome

NEW 6 months ago

You can use the conversion tool https://gamebuino.com/creations/png-to-code to make it to code or you could make a BMP with all frames stacked and stream that from the SD card.

The library does not support PNG

BlinkyShay

5 months ago

Can you show me simple example how to put frames loaded from SD card into the animation function?

Can i make something like that?

if(armor == type1) {
const uint16_t 1Data[] = {41,30,1, 1, 0, 0, 0xF81F, ... ,0xF81F};  Image 1 = Image(1Data);
const uint16_t 2Data[] = {41,30,1, 1, 0, 0, 0xF81F, ... ,0xF81F};  Image 2 = Image(2Data);
}
frame1 = Image(1Data);
frame2 = Image(2Data);
const uint8_t myAnimBuf[] = {  8, 8,   0x2A, 0x00, 1,  0xFF, // no transparency  1, 
 frame1, frame2
};

BlinkyShay

NEW 5 months ago

Sorunome Sorunome

Can you show me simple example how to put frames loaded from SD card into the animation function?

Can i make something like that?

if(armor == type1) {
const uint16_t 1Data[] = {41,30,1, 1, 0, 0, 0xF81F, ... ,0xF81F};  Image 1 = Image(1Data);
const uint16_t 2Data[] = {41,30,1, 1, 0, 0, 0xF81F, ... ,0xF81F};  Image 2 = Image(2Data);
}
frame1 = Image(1Data);
frame2 = Image(2Data);
const uint8_t myAnimBuf[] = {  8, 8,   0x2A, 0x00, 1,  0xFF, // no transparency  1, 
 frame1, frame2
};

Sorunome

NEW 5 months ago

Images tutorial: https://gamebuino.com/creations/images section "Image Animations" you just consecutively put the raw data in there, not image objects

BlinkyShay

5 months ago

Ok, but if i want to change this raw data in function for another image data and don't save all raw data in code, but on sd card?
Because if i put in this function my data i cant change them for another, and that is what i want to do.
I don't want to make several functions with different data in it, I want to make one standing animation function and put in it different kinds of data. ( different armor image data ).
So my question is do I have to make single "Image animations" function as you mention before for every kind of armor, or there is a way to make only one image animation function and stream into it convert image data from SD card.

I'm sorry for the number of my questions, I am new at this : D

BlinkyShay

NEW 5 months ago

Sorunome Sorunome

Ok, but if i want to change this raw data in function for another image data and don't save all raw data in code, but on sd card?
Because if i put in this function my data i cant change them for another, and that is what i want to do.
I don't want to make several functions with different data in it, I want to make one standing animation function and put in it different kinds of data. ( different armor image data ).
So my question is do I have to make single "Image animations" function as you mention before for every kind of armor, or there is a way to make only one image animation function and stream into it convert image data from SD card.

I'm sorry for the number of my questions, I am new at this : D

clement

NEW 5 months ago

I had trouble understanding the tutorial for the images, to create annimation. no complete and working exemple :( 

you need to create a stacked image like this  :


after you cane use it like this :

https://github.com/Clement83/SavePrincesseMeta/blob/1b9148300b52117658521e2acacc8f98151ef192/SavePrincesseMeta.ino#L38


I translate the comment on top of image , I cant post all code here is to big


//80 : Width 
//64: height 
//2 : number of frame
//25 : I change image all 25 frame, in other words all seconds
//0 : no transparency
//0 : image in rgb 565
// all other parameter is the converted image with the butiful tool  => https://gamebuino.com/fr/creations/png-to-code


I hope that help :)

You must be logged in in order to post a message on the forum

Log in