Example usage for com.badlogic.gdx.graphics.g2d Animation getAnimationDuration

List of usage examples for com.badlogic.gdx.graphics.g2d Animation getAnimationDuration

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d Animation getAnimationDuration.

Prototype

public float getAnimationDuration() 

Source Link

Usage

From source file:com.github.skittishSloth.openSkies.battles.ships.PlayerShip.java

public TextureRegion getCurrentFrame(final float deltaTime) {
    final Animation curAnim;
    switch (bankState) {
    case NONE:/*from   w ww.  j  a  va2s  .c om*/
        curAnim = baseAnimation;
        break;
    case LEFT:
        curAnim = bankLeft;
        break;
    case RIGHT:
        curAnim = bankRight;
        break;
    default:
        throw new UnsupportedOperationException("Unknown state: " + bankState);
    }

    if (movementTime > curAnim.getAnimationDuration()) {
        movementTime = curAnim.getAnimationDuration();
    }

    return curAnim.getKeyFrame(movementTime);
}