I want to change the pace of the animation during the middle of a animation.
I've been fiddling around with the setUserTimeMSec and updateUserTimeMSec functions.
I had no problems with setting the pace of the animation once. But when I need to set it during the middle of a animation, then the animation breaks, ie the Live2d character disappears off the screen.
So my question is: Can you actually change the pace of the animation during the middle of a animation? If yes, how do you do it properly?
This is what I am doing.
var multiplier = 1;
PERIODIC UPDATE FUNCTION:
if(condition){multiplier = 2;}
UtSystem.setUserTimeMSec( UtSystem.updateUserTimeMSec() * multiplier );
Comments
Something like this works fine: But something like this don't work:
Motion speed for each model has been changed .
left model(speed:1), right model(speed:5)
However , this function can't be changed dynamically .
I will try to the request to the development team to be additional functions .
After some trying, I managed to do this (speeding up animation dynamically) :
var Simple = function() { ... ha.addEventListener("mousedown", function(){ speed_up_flag1 = false; speed_up_flag = true; }); ha.addEventListener("mouseup", function(){ speed_up_flag1 = true; speed_up_flag = false; }); ... };Simple.draw = function(gl){ ... if(speed_up_flag){ UtSystem.setUserTimeMSec( UtSystem.updateUserTimeMSec()*2 ); } if(speed_up_flag1){ UtSystem.setUserTimeMSec( UtSystem.updateUserTimeMSec()*3 ); } live2DModel.update(); live2DModel.draw(); }HOWEVER, I can't slow down the animation, for example, like this (i.e. setting it to a faster pace, and then setting it to a slower pace) :if(speed_up_flag){ UtSystem.setUserTimeMSec( UtSystem.updateUserTimeMSec()*3 ); } if(speed_up_flag1){ UtSystem.setUserTimeMSec( UtSystem.updateUserTimeMSec()*2 ); }If I can dynamically speed up the animation, why can't I dynamically slow it down?1. UtSystem.updateUserTimeMSec() * 2 → OK
2. UtSystem.updateUserTimeMSec() * 4 → OK
3. UtSystem.updateUserTimeMSec() * 6 → OK
However , the reverse is impossible .
1. UtSystem.updateUserTimeMSec() * 6 → OK
2. UtSystem.updateUserTimeMSec() * 4 → NG
3. UtSystem.updateUserTimeMSec() * 2 → NG
When you debug the value of updateUserTimeMSec(), time increases .
It can't possibly return the time .
I think that it is not a dynamically changing function of the speed .