Open coeuvre opened 10 years ago
Animation from GIFs? Is that a good idea?
It's a good idea! So we need a library to read GIF format first.
rust-image is a good start. I think it can read animated GIFs but it doesn't have a good API for using them.
One idea would be to improve the API or building something on top of it.
Now we can change the sprite's texture easily by
sprite.set_texture(...)
. We can manually set the sprite's texture to do animation but we should have a convenient way to do it.One way in my mind is that we can define a struct
Animation
to describe the animation which may contain information like:Once we have the
Animation
, we can construct anAction
for it. So to do animation, the code may look like:As we can pause/resume/toggle/stop actions, we can easily pause/resume/toggle/stop animations.
We should focus on this after #6 finished.
Any suggestions?