user2130089
user2130089

Reputation: 23

Dynamically(at some time intervals) change textures on a plane/cube in three.js?

I know it's something with texture.needsUpdate() while rendering but I don't have a clue how to actually implement it. Maybe someone knows a link where I can see a working example or post some piece of code? Cheers.

Upvotes: 1

Views: 683

Answers (1)

Stemkoski
Stemkoski

Reputation: 9045

An excellent question; I created some sample code to do exactly this -- using a spritesheet to do some 2D animation on a plane and on a cube, which requires regular updates. Here is a link to a documented example, that in particular contains a function to do exactly what you need.

http://stemkoski.github.com/Three.js/Texture-Animation.html

Hope it helps!

Upvotes: 1

Related Questions