spritefire Posted January 22, 2016 Share Posted January 22, 2016 Hiyas Just wondering if there is a way to create an animation (without using the scene.registerBeforeRender ) that changes / blends materials? I want a mesh to fade from one diffuse colour into another. I have it working using scene.registerBeforeRender however there are a lot of different meshes that have different animations at different key frames and am hoping it can be done easier. I have a feeling that it's to do with the target property "material" (but I would assume this would be ok) or the values in the keys? var glowLogoMaterialKeys = []; var animationGlowLogoMaterial = new BABYLON.Animation("glowLogoMaterialKeys", "material", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); glowLogoMaterialKeys.push( { frame: 0, value: new BABYLON.Color3(1, 0, 0) }, { frame: 20, value: new BABYLON.Color3(0, 1, 0) } ); animationGlowLogoMaterial.setKeys(glowLogoMaterialKeys); scene.glowLogo.animations.push(animationGlowLogoMaterial); scene.beginAnimation(scene.glowLogo, 0, 100, false); I have also tried with target property of "material.diffuseColor" and still no luck Quote Link to comment Share on other sites More sharing options...
spritefire Posted January 22, 2016 Author Share Posted January 22, 2016 Ugh please ignore. I just noticed I had BABYLON.Animation.ANIMATIONTYPE_FLOAT instead of BABYLON.Animation.ANIMATIONTYPE_COLOR3. The perils of copying and pasting segments of code :/ GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 22, 2016 Share Posted January 22, 2016 I love this kind of questions Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 22, 2016 Share Posted January 22, 2016 Me too!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.