Maciej Wojcik
Maciej Wojcik

Reputation: 2171

Is there possibility to use GIF animation in threejs?

I'm really confused about the use of GIF animations in threejs. There are no examples on google, I can't find any statement about gifs, are they supported or no?

I can not believe that threejs has a problem with GIF animations. Is it really hard to implement?

I only want to add to my space rocket prepared to fire from my graphic designer.

Any clues? Please I'm run out of the ideas.

Upvotes: 3

Views: 2010

Answers (1)

Mugen87
Mugen87

Reputation: 31026

You can't directly use an animated GIF in three.js as a texture. You have the following options:

  • Convert the GIF to a video (e.g. MP4) and then use THREE.VideoTexture.
  • Create a sprite sheet which contains all frames of the animation and use it as an ordinary THREE.Texture. The animation is done by offsetting the respective texture coordinates per frame.
  • Try to use SuperGif like describe in another stackoverflow post.

Related discussion at the three.js forum: GIF as animated texture?

three.js R103

Upvotes: 6

Related Questions