gsap - Animate between two materials on a mesh Three.js -


i trying change meshes material material on time (preferably using greensock animation platform). there way using non shader materials?

pseudo code:

tweenmax.to(mesh.material.map, 1, {image:newtexture}); 

you want tween 1 material without writing custom shadermaterial.

here 1 way achieve effect. requires duplicating mesh, though.

var mesh = new three.mesh( geometry, material1 ); // transparent false scene.add( mesh );  var mesh2 = new three.mesh( geometry, material2 ); // transparent true, opacity 0 scene.add( mesh2 );  //mesh2.onbeforerender = function ( renderer ) { renderer.cleardepth(); }; // optional  var tween = new tween.tween( mesh2.material )     .to( { opacity: 1 }, 1500 )     .delay( 1500 )     .start(); 

be sure call

tween.update(); 

in animation loop.

three.js r.87


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -