Java Code Examples for com.jme3.animation.LoopMode#Loop

The following examples show how to use com.jme3.animation.LoopMode#Loop . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractCinematicEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Used internally only.
 * @param tpf time per frame.
 */
@Override
public void internalUpdate(float tpf) {
    if (playState == PlayState.Playing) {
        time = time + (tpf * speed);         
        onUpdate(tpf);
        if (time >= initialDuration && loopMode == LoopMode.DontLoop) {
            stop();
        } else if(time >= initialDuration && loopMode == LoopMode.Loop){
            setTime(0);
        }else{
            time = AnimationUtils.clampWrapTime(time, initialDuration, loopMode);
            if(time<0){
                speed = - speed;
                time = - time;
            }
        }
    }

}
 
Example 2
Source File: MotionEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void internalUpdate(float tpf) {
    if (playState == PlayState.Playing) {
        time = time + (tpf * speed);
        if (loopMode == LoopMode.Loop && time < 0) {
            time = initialDuration;
        }            
        if ((time >= initialDuration || time < 0) && loopMode == LoopMode.DontLoop) {
            if (time >= initialDuration) {
                path.triggerWayPointReach(path.getNbWayPoints() - 1, this);
            }
            stop();
        } else {
            time = AnimationUtils.clampWrapTime(time, initialDuration, loopMode);
            if(time<0){
                speed = - speed;
                time = - time;
            }
            onUpdate(tpf);
        }
    }
}
 
Example 3
Source File: MotionTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void onUpdate(float tpf) {
    path.interpolatePath(tpf * speed, this);
    computeTargetDirection();

    if (currentValue >= 1.0f) {
        currentValue = 0;
        currentWayPoint++;
        path.triggerWayPointReach(currentWayPoint, this);
    }
    if (currentWayPoint == path.getNbWayPoints() - 1) {
        if (loopMode == LoopMode.Loop) {
            currentWayPoint = 0;
        } else {
            stop();
        }
    }
}
 
Example 4
Source File: AnimationControlTreeNode.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
public AnimationControlTreeNode(@NotNull final AnimControl element, final long objectId) {
    super(element, objectId);
    this.loopMode = LoopMode.Loop;
    this.speed = 1.0F;
}