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

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

Introduction

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

Prototype

public float getFrameDuration() 

Source Link

Usage

From source file:com.github.fauu.helix.graphics.AnimatedDecal.java

License:Apache License

@Override
public void flipFrames(float startTime, float endTime, boolean flipX, boolean flipY, boolean set) {
    Animation animation = getAnimated();

    for (float t = startTime; t < endTime; t += animation.getFrameDuration()) {
        TextureRegion frame = animation.getKeyFrame(t);
        frame.flip(flipX && (!set || !frame.isFlipX()), flipY && (!set || !frame.isFlipY()));
    }/*from w w w . ja  va2s . c  om*/
}

From source file:net.dermetfan.utils.libgdx.graphics.ManagedAnimation.java

License:Apache License

/** flips all frames from {@code startTime} to {@code endTime}
 *  @param startTime the animation state time of the first frame to flip
 *  @param endTime the animation state time of the last frame to flip
 *  @param set if the frames should be set to {@code flipX} and {@code flipY} instead of actually flipping them */
default void flipFrames(float startTime, float endTime, boolean flipX, boolean flipY, boolean set) {
    Animation animation = getAnimated();
    for (float t = startTime; t < endTime; t += animation.getFrameDuration()) {
        TextureRegion frame = animation.getKeyFrame(t);
        frame.flip(flipX && (set ? !frame.isFlipX() : true), flipY && (set ? !frame.isFlipY() : true));
    }/*w w  w .  jav  a2s . c  om*/
}