use of com.gemserk.animation4j.gdx.Animation in project commons-gdx by gemserk.
the class AnimationResourceBuilder method build.
@Override
public Animation build() {
Texture spriteSheet = resourceManager.getResourceValue(spriteSheetId);
Sprite[] frames = new Sprite[this.frames.size()];
float[] times = new float[this.frames.size()];
for (int i = 0; i < frames.length; i++) {
Frame frame = this.frames.get(i);
frames[i] = new Sprite(spriteSheet, frame.x, frame.y, frame.w, frame.h);
// convert time from milliseconds to seconds
times[i] = (float) frame.time * 0.001f;
}
return new Animation(frames, new FrameAnimationImpl(loop, times));
}
Aggregations