shawnlawson / The_Force

webGL live coding performance IDE
https://shawnlawson.github.io/The_Force/
MIT License
274 stars 52 forks source link

Allowing animated gifs as textures #31

Open JuanFdS opened 3 years ago

JuanFdS commented 3 years ago

Right now gifs can be uploaded as textures.

However, they aren't animated and instead get frozen at some frame, it'd be nice to have them animated.

Recording of usage of The Force. An animated gif displaying a cartoon rock is uploaded and used in the shader to show that the image rendered is frozen in a frame instead of being animated.

JuanFdS commented 3 years ago

Hi! @shawnlawson , how are you?

I'm working on a possible implementation for this. I have 2 ideas of how it could be done:

I'm already working on the first one locally and after hardcoding a lot of stuff (I already have the frames + know their duration + changed the code in the nyan cat texture to load this instead) was able to get something working test

However, in order to get any of the 2 options done I think we'd need to add a dependency to split the gif into frames or turn it into a video. And I think I'll need some help understanding how to add that to this project :P

For example, let's say I wanted to add this dependency to split the gif into frames: https://github.com/matt-way/gifuct-js how should I do it? 🤔

shawnlawson commented 3 years ago

Oh, I see, hmmm. I suppose if the dependency can be built into an include-able file that would work. I can work on that, but not for a couple weeks. Looks pretty awesome though!

shawnlawson commented 3 years ago

putting these here so I don't forget them. https://github.com/movableink/three-gif-loader https://github.com/MaciejWWojcik/three-plain-animator