本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.model.Animation类的典型用法代码示例。如果您正苦于以下问题:Java Animation类的具体用法?Java Animation怎么用?Java Animation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Animation类属于com.badlogic.gdx.graphics.g3d.model包,在下文中一共展示了Animation类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applyAnimations
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** Apply two animations, blending the second onto to first using weight. */
protected void applyAnimations (final Animation anim1, final float time1, final Animation anim2, final float time2,
final float weight) {
if (anim2 == null || weight == 0.f)
applyAnimation(anim1, time1);
else if (anim1 == null || weight == 1.f)
applyAnimation(anim2, time2);
else if (applying)
throw new GdxRuntimeException("Call end() first");
else {
begin();
apply(anim1, time1, 1.f);
apply(anim2, time2, weight);
end();
}
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:17,代码来源:BaseAnimationController.java
示例2: loadAnimations
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
private void loadAnimations (Iterable<ModelAnimation> modelAnimations) {
for (final ModelAnimation anim : modelAnimations) {
Animation animation = new Animation();
animation.id = anim.id;
for (ModelNodeAnimation nanim : anim.nodeAnimations) {
final Node node = getNode(nanim.nodeId);
if (node == null) continue;
NodeAnimation nodeAnim = new NodeAnimation();
nodeAnim.node = node;
for (ModelNodeKeyframe kf : nanim.keyframes) {
if (kf.keytime > animation.duration) animation.duration = kf.keytime;
NodeKeyframe keyframe = new NodeKeyframe();
keyframe.keytime = kf.keytime;
keyframe.rotation.set(kf.rotation == null ? node.rotation : kf.rotation);
keyframe.scale.set(kf.scale == null ? node.scale : kf.scale);
keyframe.translation.set(kf.translation == null ? node.translation : kf.translation);
nodeAnim.keyframes.add(keyframe);
}
if (nodeAnim.keyframes.size > 0) animation.nodeAnimations.add(nodeAnim);
}
if (animation.nodeAnimations.size > 0) animations.add(animation);
}
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:24,代码来源:Model.java
示例3: switchAnimation
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
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);
}
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:17,代码来源:SkeletonTest.java
示例4: switchAnimation
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
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);
}
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:17,代码来源:ModelTest.java
示例5: copyAnimations
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
private void copyAnimations (final Iterable<Animation> source) {
for (final Animation anim : source) {
Animation animation = new Animation();
animation.id = anim.id;
animation.duration = anim.duration;
for (final NodeAnimation nanim : anim.nodeAnimations) {
final Node node = getNode(nanim.node.id);
if (node == null)
continue;
NodeAnimation nodeAnim = new NodeAnimation();
nodeAnim.node = node;
for (final NodeKeyframe kf : nanim.keyframes) {
NodeKeyframe keyframe = new NodeKeyframe();
keyframe.keytime = kf.keytime;
keyframe.rotation.set(kf.rotation);
keyframe.scale.set(kf.scale);
keyframe.translation.set(kf.translation);
nodeAnim.keyframes.add(keyframe);
}
if (nodeAnim.keyframes.size > 0)
animation.nodeAnimations.add(nodeAnim);
}
if (animation.nodeAnimations.size > 0)
animations.add(animation);
}
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:27,代码来源:SharedModel.java
示例6: obtain
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
private AnimationDesc obtain (final Animation anim, float offset, float duration, int loopCount, float speed,
final AnimationListener listener) {
if (anim == null) return null;
final AnimationDesc result = animationPool.obtain();
result.animation = anim;
result.listener = listener;
result.loopCount = loopCount;
result.speed = speed;
result.offset = offset;
result.duration = duration < 0 ? (anim.duration - offset) : duration;
result.time = speed < 0 ? result.duration : 0.f;
return result;
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:14,代码来源:AnimationController.java
示例7: getAnimation
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** @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;
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:16,代码来源:Model.java
示例8: copyAnimations
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
private void copyAnimations (final Iterable<Animation> source, boolean shareKeyframes) {
for (final Animation anim : source) {
Animation animation = new Animation();
animation.id = anim.id;
animation.duration = anim.duration;
for (final NodeAnimation nanim : anim.nodeAnimations) {
final Node node = getNode(nanim.node.id);
if (node == null) continue;
NodeAnimation nodeAnim = new NodeAnimation();
nodeAnim.node = node;
if (shareKeyframes)
nodeAnim.keyframes = nanim.keyframes;
else {
for (final NodeKeyframe kf : nanim.keyframes) {
NodeKeyframe keyframe = new NodeKeyframe();
keyframe.keytime = kf.keytime;
keyframe.rotation.set(kf.rotation);
keyframe.scale.set(kf.scale);
keyframe.translation.set(kf.translation);
nodeAnim.keyframes.add(keyframe);
}
}
if (nodeAnim.keyframes.size > 0) animation.nodeAnimations.add(nodeAnim);
}
if (animation.nodeAnimations.size > 0) animations.add(animation);
}
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:29,代码来源:ModelInstance.java
示例9: animateIfAnimationExists
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
public boolean animateIfAnimationExists(String id) {
for (Animation animation : instance.animations) {
if (animation.id.equalsIgnoreCase(id)) {
animationController.setAnimation(id);
return true;
}
}
return false;
}
开发者ID:fauu,项目名称:HelixEngine,代码行数:12,代码来源:ModelDisplayable.java
示例10: getInternalAnimations
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
@Override
public String[] getInternalAnimations(AnimationDesc anim) {
retrieveSource(anim.source);
Array<Animation> animations = ((ModelCacheEntry)sourceCache.get(anim.source)).modelInstance.animations;
String[] result = new String[animations.size];
for (int i = 0; i < animations.size; i++) {
Animation a = animations.get(i);
result[i] = a.id;
}
return result;
}
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:15,代码来源:Sprite3DRenderer.java
示例11: getAnimation
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** @param id The ID of the animation to fetch.
* @param ignoreCase whether to use case sensitivity when comparing the animation id.
* @return The {@link com.badlogic.gdx.graphics.g3d.model.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;
}
开发者ID:jrenner,项目名称:gdx-proto,代码行数:16,代码来源:HeadlessModel.java
示例12: getAnimation
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** @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;
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:18,代码来源:SharedModel.java
示例13: apply
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** Apply an animation, must be called between {{@link #begin()} and {{@link #end()}.
* @param weight The blend weight of this animation relative to the previous applied animations. */
protected void apply (final Animation animation, final float time, final float weight) {
if (!applying) throw new GdxRuntimeException("You must call begin() before adding an animation");
applyAnimation(transforms, transformPool, weight, animation, time);
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:7,代码来源:BaseAnimationController.java
示例14: applyAnimation
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** Apply a single animation to the {@link ModelInstance} and update the it to reflect the changes. */
protected void applyAnimation (final Animation animation, final float time) {
if (applying) throw new GdxRuntimeException("Call end() first");
applyAnimation(null, null, 1.f, animation, time);
target.calculateTransforms();
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:7,代码来源:BaseAnimationController.java
示例15: removeAnimation
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** Remove the specified animation, by marking the affected nodes as not animated. When switching animation, this should be call
* prior to applyAnimation(s). */
protected void removeAnimation (final Animation animation) {
for (final NodeAnimation nodeAnim : animation.nodeAnimations) {
nodeAnim.node.isAnimated = false;
}
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:8,代码来源:BaseAnimationController.java
示例16: setAnimation
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** Set the active animation, replacing any current animation. */
protected AnimationDesc setAnimation (final Animation anim, float offset, float duration, int loopCount, float speed,
final AnimationListener listener) {
return setAnimation(obtain(anim, offset, duration, loopCount, speed, listener));
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:AnimationController.java
示例17: animate
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** Changes the current animation by blending the new on top of the old during the transition time. */
protected AnimationDesc animate (final Animation anim, float offset, float duration, int loopCount, float speed,
final AnimationListener listener, float transitionTime) {
return animate(obtain(anim, offset, duration, loopCount, speed, listener), transitionTime);
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:AnimationController.java
示例18: queue
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** Queue an animation to be applied when the current is finished. If current is continuous it will be synced on next loop. */
protected AnimationDesc queue (final Animation anim, float offset, float duration, int loopCount, float speed,
final AnimationListener listener, float transitionTime) {
return queue(obtain(anim, offset, duration, loopCount, speed, listener), transitionTime);
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:AnimationController.java
示例19: action
import com.badlogic.gdx.graphics.g3d.model.Animation; //导入依赖的package包/类
/** Apply an action animation on top of the current animation. */
protected AnimationDesc action (final Animation anim, float offset, float duration, int loopCount, float speed,
final AnimationListener listener, float transitionTime) {
return action(obtain(anim, offset, duration, loopCount, speed, listener), transitionTime);
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:6,代码来源:AnimationController.java
注:本文中的com.badlogic.gdx.graphics.g3d.model.Animation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论