qoh / TISFAT-Zero

A 2D figure-based keyframe animation program
6 stars 7 forks source link

Add Gif Layer that animates #81

Open ghost opened 7 years ago

ghost commented 7 years ago

When adding a layer with an animated gif image. The animation does not run.

Is it possible when loading a layer with Gif, the individual image frame of the gif is inserted as a image keyframe of the layer so that the animated gif will ANIMATE?

evsl commented 7 years ago

Hypothetically possible, yes. However I don't believe that there is a decent library for reading .gif files; I'd have to implement that myself. For now, you'd have to add the bitmaps in sequence to a custom figure and then you could switch between the frames manually

ghost commented 7 years ago

I just tested https://github.com/evanolds/GIFFrame It is possible to extract individual images from a gif file. I just at the beginning of learning your software. Could you please suggest where I could insert indiv image into the layer?

The software is great and rare for .NET community. It would be great if there is a way to ORGANIZE animated images (gifs) or sets of animated custom stick figures as reusable items

evsl commented 7 years ago

Oh neat. Definitely could look into better ways to organize things. As far as where to insert images into the layer in terms of code, take a look at BitmapObject.cs. Implementation of an object that can work with GIFs would be a modified version of the BitmapObject.

ghost commented 7 years ago

Thanks for your suggestion. I took a look at BitmapObject.cs I could see two possibilities. Create a GifImageObject.cs, this create a list of BitmapObjects but created within one layer but inserted in different sequential framesets. The individual manipulation of each of these BitmapObjects will be disabled. Clicking on each of these BitmapObjects leads to group moving of these set of BitmapObjects. However, implementing that will not be trivial as I still studying your codes. However, I really like your design. It is very logical.

evsl commented 7 years ago

Kind of; What I would do if I were implementing this (without getting into much detail) would be a reimplementation of BitmapObject.cs.

Basically, where BitmapObjects have

public Bitmap Texture;

Which gets drawn in the draw function, I'd reimplement it so that it stores a

public List<Bitmap> Textures;

which is just a list of all of the frames in the gif, and it picks a frame based on the time of the state. I'd even probably create a custom State object for the new type that keeps track of the frame for me.