/** * No ClassCastException when clear() a Cinematic with AnimationEvent */ @Test public void clearAnimationEvent() { Cinematic sut = new Cinematic(); Node model = new Node("model"); AnimControl ac = new AnimControl(); ac.addAnim(new Animation("animName", 1.0f)); model.addControl(ac); sut.enqueueCinematicEvent(new AnimationEvent(model, "animName")); sut.initialize(null, null); sut.clear(); } }
control.addAnim(animationFactory.buildAnimation());
af.addTimeTranslation(0.35f, new Vector3f(0, 1, -1.5f)); af.addTimeTranslation(0.7f, new Vector3f(0, 0, 0)); jaime.getControl(AnimControl.class).addAnim(af.buildAnimation());
factory.addTimeRotationAngles(20, 0, 4 * FastMath.TWO_PI, 0); AnimControl control = new AnimControl(); control.addAnim(factory.buildAnimation()); teapot.addControl(control);
private AnimControl createAnimControl(Node parent, DAENode animationsNode, List<DAENode> geomElementList, Skeleton skeleton) { Mesh[] meshes = new Mesh[geomElementList.size()]; int index = 0; for (DAENode geomNode : geomElementList) { meshes[index] = geomNode.getParsedData(Mesh.class); index++; } Animation[] animations = createAnimations(animationsNode, skeleton); AnimControl animation = new AnimControl(skeleton); animation.setAnimations(new HashMap<String, Animation>()); for (Animation Animation : animations) { animation.addAnim(Animation); } animation.setEnabled(false); return animation; }
animation.setTracks(poseTracks.toArray(new PoseTrack[poseTracks.size()])); AnimControl control = new AnimControl(); control.addAnim(animation); node.addControl(control);
animControl = new AnimControl(); animControl.addAnim(newAnimation); attachedSpatial.addControl(animControl); AnimChannel animChannel = animControl.createChannel();
protected void moveViaAnimation(Vector3f newPosition, Quaternion newOrientation, float duration) { clearMoveAnimationBindings(); Vector3f currentPosition = myNode.getLocalTranslation(); Quaternion currentOrientation = myNode.getLocalRotation(); if (newPosition == null) { newPosition = currentPosition; } if (newOrientation == null) { newOrientation = currentOrientation; } AnimationFactory aniFactory = new AnimationFactory(duration, MOVE_ANIM_NAME); // First add starting position/rotation to timeline at index 0 aniFactory.addKeyFrameTranslation(0, currentPosition); aniFactory.addKeyFrameRotation(0, currentOrientation); // Now add new position/rotation at duration: aniFactory.addTimeTranslation(duration, newPosition); aniFactory.addTimeRotation(duration, newOrientation); // Finally the Animation is generated and linked to the geometry via an AnimationControl Animation moveAnimation = aniFactory.buildAnimation(); figureControl.addAnim(moveAnimation); myNode.addControl(figureControl); AnimChannel moveChannel = figureControl.createChannel(); moveChannel.setAnim(MOVE_ANIM_NAME, 0f); // Oddly, it seems this needs to be set *after* starting the animation with setAnim: moveChannel.setLoopMode(LoopMode.DontLoop); }
protected void moveViaAnimation(Vector3f newPosition, Quaternion newOrientation, Vector3f newScale, float duration) { final String moveAnimName = "BasicGoodyMoveFactory"; AnimationFactory aniFactory = new AnimationFactory(duration, moveAnimName); // First add starting position/rotation/scale to timeline at index 0 aniFactory.addKeyFrameTranslation(0, myPosition); aniFactory.addKeyFrameRotation(0, getTotalRotation(getCurrentAttachedGeomBinding())); aniFactory.addKeyFrameScale(0, myScaleVec); // Now add new position/rotation/scale at duration: setNewPositionAndRotationIfNonNull(newPosition, newOrientation); if (newScale != null) { myScaleVec = newScale; } aniFactory.addTimeTranslation(duration, myPosition); aniFactory.addTimeRotation(duration, getTotalRotation(getCurrentAttachedGeomBinding())); aniFactory.addTimeScale(duration, myScaleVec); // Finally the Animation is generated and linked to the geometry via an AnimationControl Animation moveAnimation = aniFactory.buildAnimation(); AnimControl goodyControl = new AnimControl(); // Should this be retained for reuse? goodyControl.addAnim(moveAnimation); getCurrentAttachedGeometry().addControl(goodyControl); AnimChannel moveChannel = goodyControl.createChannel(); moveChannel.setAnim(moveAnimName, 0f); // Oddly, it seems this needs to be set *after* starting the animation with setAnim: moveChannel.setLoopMode(LoopMode.DontLoop); }
anim.addAnim(boneAnim); AnimChannel channel = anim.createChannel(); channel.setAnim("test animation");