Index: /orxonox/branches/textEngine/src/animation.cc
===================================================================
--- /orxonox/branches/textEngine/src/animation.cc	(revision 3783)
+++ /orxonox/branches/textEngine/src/animation.cc	(revision 3784)
@@ -17,10 +17,98 @@
 #include "animation.h"
 #include "debug.h"
+#include "list.h"
 
 
 Anim::Anim(void)
 {
+  // create a new List
+  this->keyFrameList = new tList<AnimKeyFrame>();
+  
+  // initialize a beginning KeyFrame, that will be deleted afterwards
+  this->bHasKeys = false;
+
+
+  this->animFunc = &Anim::random;
 }
 
 
+Anim::~Anim(void)
+{
+  // delete all the KeyFrames
+  tIterator<AnimKeyFrame>* itKF = keyFrameList->getIterator();
+  AnimKeyFrame*  enumKF = itKF->nextElement();
+  while (enumKF)
+    {
+      delete enumKF;
+      enumKF = itKF->nextElement();
+    }
+  delete itKF;
+  delete this->keyFrameList;
+}
+
 tList<Anim>* Anim::animatorList = NULL;
+
+
+void Anim::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc)
+{
+  if (!bHasKeys)
+    {
+      this->keyFrameList->remove(this->keyFrameList->firstElement());
+      bHasKeys = true;
+    }
+  AnimKeyFrame* tmpKeyFrame = new AnimKeyFrame;
+  tmpKeyFrame->value = value;
+  tmpKeyFrame->duration = duration;
+  tmpKeyFrame->animFunc = animFunc;
+  
+  this->keyFrameList->add(tmpKeyFrame);
+}
+
+void Anim::setInfinity(ANIM_INFINITY preInfinity, ANIM_INFINITY postInfinity)
+{
+  this->preInfinity = preInfinity;
+  this->postInfinity = postInfinity;
+}
+
+void Anim::setAnimFunc(ANIM_FUNCTION animFunc)
+{
+  switch (animFunc)
+    {
+    default:
+    case ANIM_CONSTANT:
+      this->animFunc = &Anim::constant;
+      break;
+    case ANIM_LINEAR:
+      this->animFunc = &Anim::linear;
+      break;
+    case ANIM_RANDOM:
+      this->animFunc = &Anim::random;
+      break;
+    case ANIM_SINE:
+      this->animFunc = &Anim::sine;
+      break;
+
+    }
+}
+
+
+// animation functions
+float Anim::random(float time)
+{
+  return (float)rand()/(float)RAND_MAX;
+}
+
+float Anim::constant(float time)
+{
+
+}
+
+float Anim::linear(float time)
+{
+
+}
+
+float Anim::sine(float time)
+{
+
+}
Index: /orxonox/branches/textEngine/src/animation.h
===================================================================
--- /orxonox/branches/textEngine/src/animation.h	(revision 3783)
+++ /orxonox/branches/textEngine/src/animation.h	(revision 3784)
@@ -18,4 +18,8 @@
     \file animation.h
     A Set of functions to animate some floats inside of an Object
+
+    We apologize, that most part of the Function-Definitions are located 
+    inside this h-file, but this must be like this because it is a template
+    function.
 */
 
@@ -27,15 +31,51 @@
 template<class T> class tList;
 
-enum ANIM_FUNCTION {ANIM_LINEAR, ANIM_SINE };
-enum ANIM_INFINITY {ANIM_INF_CONSTANT, ANIM_INF_LINEAR, ANIM_INF_PINGPONG, ANIM_INF_REWIND};//, ANIM_DELETE}
+typedef enum ANIM_FUNCTION {ANIM_CONSTANT,
+			    ANIM_LINEAR,
+			    ANIM_SINE,
+			    ANIM_RANDOM};
+typedef enum ANIM_INFINITY {ANIM_INF_CONSTANT,
+			    ANIM_INF_LINEAR,
+			    ANIM_INF_PINGPONG,
+			    ANIM_INF_REWIND};//, ANIM_DELETE}
+
+struct AnimKeyFrame
+{
+  float duration;
+  float value;
+  ANIM_FUNCTION animFunc;
+};
 
 class Anim
 {
  protected:
-  Anim();
+  Anim(void);
+  virtual ~Anim(void);
 
   static tList<Anim>* animatorList;
 
   virtual void tick(float time) = 0;
+
+  void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR);
+  void setInfinity(ANIM_INFINITY preInfinity = ANIM_INF_CONSTANT,
+		   ANIM_INFINITY postInfinity = ANIM_INF_CONSTANT);
+  void setAnimFunc(ANIM_FUNCTION animFunc);
+
+
+  // animation functions
+  float random(float time);
+  float constant(float time);
+  float linear(float time);
+  float sine(float time);
+
+
+  // variables
+  //  ANIM_FUNCTION animFunc;
+  float (Anim::*animFunc)(float);
+  ANIM_INFINITY preInfinity;
+  ANIM_INFINITY postInfinity;
+
+  bool bHasKeys;
+  tList<AnimKeyFrame>* keyFrameList;
 };
 
@@ -45,18 +85,14 @@
 {
  public:
-  Animation();
+  Animation(T* object = NULL, void (T::*funcToAnim)(float) = NULL);
   virtual ~Animation();
 
   void setFuncToAnim(T* object, void (T::*funcToAnim)(float));
-  void setAnimFunc(ANIM_FUNCTION animFunc);
-  void setValue(float value);
 
   virtual void tick(float time);
 
  private:
+  T* object;
   void (T::*funcToAnim)(float);
-  ANIM_FUNCTION animFunc;
-  float value;
-  T* object;
 };
 
@@ -68,7 +104,7 @@
 */
 template<class T>
-Animation<T>::Animation () 
+Animation<T>::Animation (T* object, void (T::*funcToAnim)(float)) 
 {
-   this->value = 0.0;
+  this->setFuncToAnim(object, funcToAnim);
 }
 
@@ -92,17 +128,9 @@
 }
 
-template<class T>
-void Animation<T>::setValue(float value)
-{
-  this->value = value;
-  (object->*(funcToAnim))(value);
-}
 
 template<class T>
 void Animation<T>::tick(float time)
 {
-  setValue(value - time/1000);
-  if (value < 0)
-    setValue (1.0);
+  (this->object->*(funcToAnim))((this->*animFunc)(time));
 }
 
Index: /orxonox/branches/textEngine/src/story_entities/world.cc
===================================================================
--- /orxonox/branches/textEngine/src/story_entities/world.cc	(revision 3783)
+++ /orxonox/branches/textEngine/src/story_entities/world.cc	(revision 3784)
@@ -360,7 +360,7 @@
 
 	    
-	    tmpAnim = new Animation<Text>();
-
-	    tmpAnim->setFuncToAnim(testText, &Text::setBlending);
+	    tmpAnim = new Animation<Text>(testText, &Text::setBlending);
+
+	    //	    tmpAnim->setFuncToAnim(testText, &Text::setBlending);
 	    break;
 	  }
