Can you animate the colors of a loaded JSON model in three.js?
In my code, I used the ObjectLoader()
to render the model. Now, I want to be able to animate the color of the model after it's been loaded.
var objectLoader = new THREE.ObjectLoader();
var model;
objectLoader.load("path/to/model.json", function ( obj ) {
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ){
model = child.material.color;
}
});
scene.add( obj );
} );
I'm interested in using GSAP for the animation. I know I can change the color of the model
with
model.material.color.setRGB(1,1,1);
, but is there a way to animate it as well?