- Изменено
[webgl] 2 animations on same skeleton simultaneously
Hi,
I have character skeleton. It has multiple face parts and multiple animations : blink, laugh, speaking etc. The speaking animation only works with mouth slot and the blink animation only works with the eyes slot and the brows slot.
What I am trying to do is, mix 2 animations so that they run together. For example, I want to mix the blink and the speaking animations so that they run together and make it look like the character is blinking while speaking.
I tried setMix
without any luck. I am not sure I have correctly implemented it though.
animationStateData.setMix("blink", "speak", 0.8)
animationState.setAnimation(0, "blink", true);
Thanks
Ok. I figured it out. Looks like I have to play the 2nd animation in different track.
I have one other question. How do I change the canvas background to transparent? Its currently gray. I tried clearColor
but its still gray.
canvas = document.getElementById("canvas");
var config = { alpha: true };
gl = canvas.getContext("webgl", config) || canvas.getContext("experimental-webgl", config);
gl.clearColor(1, 0, 0, 1);
Glad you figured out the first issue.
As for a transparent WebGL canvas, you'll have to set the clearColor
to (0, 0, 0, 0)
, where the last parameter is the alpha value used to clear the canvas.
Just tried that. still gray.
For reference, I am having the same issue as this:
I want to set the SpineWidget background transparent
Thanks
Then you must be calling gl.clearColor()
somewhere else with the rgba values for (non-transparent) gray.
You are correct! I don't know why I did not check that earlier. Thanks for your help!