Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Initial Version and Version 1 of ~archive/AnimationPlayer


Ignore:
Timestamp:
Nov 27, 2007, 10:36:27 PM (16 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • ~archive/AnimationPlayer

    v1 v1  
     1= AnimationPlayer =
     2The AnimationPlayer is a Class that handles Animations of many different Kinds.
     3The AnimationPlayer sets all animations into movement.
     4The AnimationPlayer holds a List of all Animation's
     5
     6== Animation ==
     7An animation is a list of keyframes, which over time is iterated between.
     8
     9There are currenty two possibilities to create an Animation
     10  * Animation3D: handles movement of 3D-objects.
     11  * tAnimation: handles animation of float-variables.
     12
     13They both extend the Animation Class, and are handled with the AnimationPlayer.
     14
     15Animation knows the following important Functions:
     16
     17 * __setInfinity(ANIM_INFINITY)__: sets up what should be done with the Animation, when run to the end.
     18  * ANIM_INF_CONSTANT: Stay at the endValue, and do not do anything furthermore.
     19  * ANIM_INF_REPLAY: Replays the Animation
     20  * ANIM_INF_REWIND: goes to the beginning of the Animation and stops there
     21  * 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!!
     22
     23 * __Playing functions__:
     24  * play();       // starts Playing
     25  * stop();       // goes to the beginning and stops playing eg. rewind+pause
     26  * pause();      // pauses playing
     27  * replay();     // replays the animation eg. rewind+play
     28  * rewind();     // rewinds the function eg. go to the beginning of the animation
     29
     30 * __tick(float)__:  this advances the animation about the time given in the argument
     31
     32 * __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.
     33
     34 * __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.
     35  || 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 ||
     36  || 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 ||
     37
     38
     39=== Animation3D ===
     40example:
     41{{{
     42#!cpp
     43#include "animation3D.h"
     44...
     45
     46PNode* dummy = new PNode();                      // creates a new ParentNode that we will animate
     47Animation3D* animation = new Animation3D(dummy); // creates a new Animation that operates on the transformation of dummy.
     48
     49animation->setInfinity(ANIM_INF_REPLAY);        // tell the animation to replay at the end
     50
     51/* adding a KeyFrame, that has position 0/0/0,
     52 standard Quaternion,
     53 the duration to the next Keyframe will be 1.0 seconds,
     54 and the type of animation will be linear. */
     55animation->addKeyFrame(Vector(), Quaternion(), 1.0, ANIM_LINEAR);
     56
     57// this adds a second KeyFrame, at Position 1/0/0.
     58animation->addKeyFrame(Vector(1, 0, 0), Quaternion(), 0.5, ANIM_CONST);
     59....
     60}}}
     61
     62this already describes an animation of a 3D-transformation.
     63As 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.
     64[[br]] this is already everything you have to know about this.
     65
     66=== tAnimation ===
     67the 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.
     68[[br]]
     69example:
     70{{{
     71#!cpp
     72#include "t_animation.h"
     73...
     74
     75// initialize this->trackText
     76
     77/* create a new Animation on the Class Text,
     78   object trackText
     79   function Text::setBlending(float)
     80*/
     81tAnimation<Text>* textAnimation = new tAnimation<Text>(this->trackText, &Text::setBlending);
     82
     83textAnimation->setInfinity(ANIM_INF_CONSTANT);
     84textAnimation->addKeyFrame(1.0, 3.0, ANIM_NEG_EXP);
     85textAnimation->addKeyFrame(0.0, .001);
     86}}}
     87
     88as 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.
     89
     90Below is a little diagram, of how the AnimationPlayer is bound into orxonox:
     91
     92http://www.orxonox.ethz.ch/additionals/AnimationPlayer.png