use of com.badlogic.gdx.graphics.g3d.model.Animation in project libgdx by libgdx.
the class SkeletonTest method switchAnimation.
protected void switchAnimation() {
for (ObjectMap.Entry<ModelInstance, AnimationController> e : animationControllers.entries()) {
int animIndex = 0;
if (e.value.current != null) {
for (int i = 0; i < e.key.animations.size; i++) {
final Animation animation = e.key.animations.get(i);
if (e.value.current.animation == animation) {
animIndex = i;
break;
}
}
}
animIndex = (animIndex + 1) % e.key.animations.size;
e.value.animate(e.key.animations.get(animIndex).id, -1, 1f, null, 0.2f);
}
}
use of com.badlogic.gdx.graphics.g3d.model.Animation in project libgdx by libgdx.
the class ModelInstance method getAnimation.
/** @param id The ID of the animation to fetch.
* @param ignoreCase whether to use case sensitivity when comparing the animation id.
* @return The {@link Animation} with the specified id, or null if not available. */
public Animation getAnimation(final String id, boolean ignoreCase) {
final int n = animations.size;
Animation animation;
if (ignoreCase) {
for (int i = 0; i < n; i++) if ((animation = animations.get(i)).id.equalsIgnoreCase(id))
return animation;
} else {
for (int i = 0; i < n; i++) if ((animation = animations.get(i)).id.equals(id))
return animation;
}
return null;
}
use of com.badlogic.gdx.graphics.g3d.model.Animation in project libgdx by libgdx.
the class ModelTest method switchAnimation.
protected void switchAnimation() {
for (ObjectMap.Entry<ModelInstance, AnimationController> e : animationControllers.entries()) {
int animIndex = 0;
if (e.value.current != null) {
for (int i = 0; i < e.key.animations.size; i++) {
final Animation animation = e.key.animations.get(i);
if (e.value.current.animation == animation) {
animIndex = i;
break;
}
}
}
animIndex = (animIndex + 1) % (e.key.animations.size + 1);
e.value.animate((animIndex == e.key.animations.size) ? null : e.key.animations.get(animIndex).id, -1, 1f, null, 0.2f);
}
}
Aggregations