I'd like to create an animated gradient material in babylon.js. I set up my gardient mateiral like this:

   var gradientMaterial = new BABYLON.GradientMaterial("grad", scene);
   gradientMaterial.topColor = new BABYLON.Color3(0, 0, 1);
   gradientMaterial.bottomColor = new BABYLON.Color3(0, 0, 0);
   gradientMaterial.offset = 0.8;
   gradientMaterial.offset = test;
   gradientMaterial.smoothness = 1;
   sphere.material = gradientMaterial;

I render my scene in the render loop:

    engine.runRenderLoop(function () {
    }); code here

I'd like to animate the gradientMaterial offset so that every 5 seconds it repeats. I'm just not sure where to iterate the .offset value.



You must log in to answer this question.

Browse other questions tagged .