Jump to content

Fading colours into another colour


spritefire
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...