= !AnimationPlayer = The !AnimationPlayer is a Class that handles Animations of many different Kinds. The !AnimationPlayer sets all animations into movement. The !AnimationPlayer holds a List of all Animation's == Animation == An animation is a list of keyframes, which over time is iterated between. There are currenty two possibilities to create an Animation * Animation3D: handles movement of 3D-objects. * tAnimation: handles animation of float-variables. They both extend the Animation Class, and are handled with the !AnimationPlayer. Animation knows the following important Functions: * __setInfinity(ANIM_INFINITY)__: sets up what should be done with the Animation, when run to the end. * ANIM_INF_CONSTANT: Stay at the endValue, and do not do anything furthermore. * ANIM_INF_REPLAY: Replays the Animation * ANIM_INF_REWIND: goes to the beginning of the Animation and stops there * ANIM_INF_DELETE: deletes the Animation: this only goes for TOTALY-handled object. eg. no references may be existent (but in !AnimationPlayer (where you do not have to care)) or SEGFAULT!! * __Playing functions__: * play(); // starts Playing * stop(); // goes to the beginning and stops playing eg. rewind+pause * pause(); // pauses playing * replay(); // replays the animation eg. rewind+play * rewind(); // rewinds the function eg. go to the beginning of the animation * __tick(float)__: this advances the animation about the time given in the argument * __doNotHandle()__: this tells the !AnimationPlayer, that this Animation will not be handled by it. Meaning it will not be ticked automatically, and will not be deleted with the !AnimationPlayer at the end of the level. * __ANIM_FUNCTION__: the last input of addKeyframe(). The following Description shows how they flow from the now added !KeyFrame to the next one. Just imagine the upper point to be the initial state and the other to be the destination: horizontal axis is time, vertical axis is location. The movement form is the projection of these functions onto a plane. eg. ANIM_SINE: first, the movement is very fast, in the middle part slow and then fast again. || https://www.orxonox.ethz.ch/pictures/wiki/ANIM_CONSTANT.jpg || https://www.orxonox.ethz.ch/pictures/wiki/ANIM_LINEAR.jpg || https://www.orxonox.ethz.ch/pictures/wiki/ANIM_SINE.jpg || || https://www.orxonox.ethz.ch/pictures/wiki/ANIM_COSINE.jpg || https://www.orxonox.ethz.ch/pictures/wiki/ANIM_EXP.jpg || https://www.orxonox.ethz.ch/pictures/wiki/ANIM_NEG_EXP.jpg || === Animation3D === example: {{{ #!cpp #include "animation3D.h" ... PNode* dummy = new PNode(); // creates a new ParentNode that we will animate Animation3D* animation = new Animation3D(dummy); // creates a new Animation that operates on the transformation of dummy. animation->setInfinity(ANIM_INF_REPLAY); // tell the animation to replay at the end /* adding a KeyFrame, that has position 0/0/0, standard Quaternion, the duration to the next Keyframe will be 1.0 seconds, and the type of animation will be linear. */ animation->addKeyFrame(Vector(), Quaternion(), 1.0, ANIM_LINEAR); // this adds a second KeyFrame, at Position 1/0/0. animation->addKeyFrame(Vector(1, 0, 0), Quaternion(), 0.5, ANIM_CONST); .... }}} this already describes an animation of a 3D-transformation. As you can see, you do not have to concern yourself with adding it to any list, because the constructor does it for you, the animation will be ticked automatically. [[br]] this is already everything you have to know about this. === tAnimation === the tAnimation is a Template-Animation, that is able to animate every function (that takes a float as input) of all the possible objects, that exist in orxonox. [[br]] example: {{{ #!cpp #include "t_animation.h" ... // initialize this->trackText /* create a new Animation on the Class Text, object trackText function Text::setBlending(float) */ tAnimation* textAnimation = new tAnimation(this->trackText, &Text::setBlending); textAnimation->setInfinity(ANIM_INF_CONSTANT); textAnimation->addKeyFrame(1.0, 3.0, ANIM_NEG_EXP); textAnimation->addKeyFrame(0.0, .001); }}} as you can see, it is practically the same as Animation3D, but the Constructor is different (a little bit more complex, but done once, do it in your sleep) and the addKeyFrame-function takes only a float instead of position and rotation as input. Below is a little diagram, of how the !AnimationPlayer is bound into orxonox: http://www.orxonox.ethz.ch/additionals/AnimationPlayer.png