Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

If you have any questions, reports, suggestions, or requests about Live2D, please send them to this forum.
※We cannot guarantee statements or answers from Live2D staff. Thank you for your understanding in advance.
 
Live2D Cubism
Cubism Products and Downloads
Cubism product manuals and tutorials
Cubism Editor Manual    Cubism Editor Tutorial    Cubism SDK Manual    Cubism SDK Tutorial
[INFORMATION](03/28/2024)
Cubism Editor 5.1 alpha version is now available!
Find out how to use the new features here.
Please take this opportunity to use it and give us your feedback!

For more information and download, please check out the Cubism Editor 5.1 alpha category.

Question - How do you change the UserTime in the middle of a game

RusRus
edited February 2016 in Help
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

  • If you can't understand my question, I will explain my problem like this:

    Something like this works fine:
    
    PERIODIC UPDATE FUNCTION:
    UtSystem.setUserTimeMSec( UtSystem.updateUserTimeMSec() * 2); // ie: a constant, and the animation goes twice as fast.
    
    But something like this don't work:
    
    PERIODIC UPDATE FUNCTION:
    UtSystem.setUserTimeMSec( UtSystem.updateUserTimeMSec() * Math.random() ); 
    
  • I am stuck with this trouble. Can someone please help me? Thank you in advance )
  • The purpose I ask this is that I want to make an animation that moves faster and faster. (if this makes my question more understand-able)
  • edited December 2015
    I have tried in Unity.
    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 .
  • Thank you. I wish I could dynamically slow-down and speed-up animations.

    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?
  • I was also able to change the speed by increasing the value .
     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 .
Sign In or Register to comment.