Index: /orxonox/branches/textEngine/src/animation.cc
===================================================================
--- /orxonox/branches/textEngine/src/animation.cc	(revision 3784)
+++ /orxonox/branches/textEngine/src/animation.cc	(revision 3785)
@@ -27,7 +27,13 @@
   // initialize a beginning KeyFrame, that will be deleted afterwards
   this->bHasKeys = false;
+  AnimKeyFrame* tmpKeyFrame = new AnimKeyFrame;
+  tmpKeyFrame->value = 0.0;
+  tmpKeyFrame->duration = 1.0;
+  keyFrameList->add(tmpKeyFrame);
 
-
-  this->animFunc = &Anim::random;
+  // setting default values
+  this->animFunc = &Anim::linear;
+  this->currentKeyFrame = tmpKeyFrame;
+  this->nextKeyFrame = tmpKeyFrame;
 }
 
@@ -52,10 +58,22 @@
 void Anim::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc)
 {
-  if (!bHasKeys)
+  // some small check
+  if (duration <= 0.0)
+    duration = 1.0;
+  
+
+  AnimKeyFrame* tmpKeyFrame;
+    
+  if (bHasKeys)
     {
-      this->keyFrameList->remove(this->keyFrameList->firstElement());
+      tmpKeyFrame = new AnimKeyFrame;
+      if (this->currentKeyFrame == this->nextKeyFrame)
+	this->nextKeyFrame = tmpKeyFrame;
+    }
+  else
+    {
+      tmpKeyFrame = this->keyFrameList->firstElement();
       bHasKeys = true;
     }
-  AnimKeyFrame* tmpKeyFrame = new AnimKeyFrame;
   tmpKeyFrame->value = value;
   tmpKeyFrame->duration = duration;
@@ -94,21 +112,24 @@
 
 // animation functions
-float Anim::random(float time)
+float Anim::random(float time) const
 {
   return (float)rand()/(float)RAND_MAX;
 }
 
-float Anim::constant(float time)
+float Anim::constant(float time) const
+{
+  return this->currentKeyFrame->value;
+}
+
+float Anim::linear(float time) const 
+{
+  return this->nextKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value) 
+    * (time*100.0 / this->currentKeyFrame->duration);
+  //  PRINTF(0)("value is %f, %p %p\n", val, this->currentKeyFrame, this->nextKeyFrame);
+  //  return val;
+}
+
+float Anim::sine(float time) const
 {
 
 }
-
-float Anim::linear(float time)
-{
-
-}
-
-float Anim::sine(float time)
-{
-
-}
Index: /orxonox/branches/textEngine/src/animation.h
===================================================================
--- /orxonox/branches/textEngine/src/animation.h	(revision 3784)
+++ /orxonox/branches/textEngine/src/animation.h	(revision 3785)
@@ -49,4 +49,10 @@
 class Anim
 {
+ public:
+  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);
+
  protected:
   Anim(void);
@@ -57,24 +63,23 @@
   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);
+  float random(float time) const;
+  float constant(float time) const;
+  float linear(float time) const;
+  float sine(float time) const;
 
 
   // variables
   //  ANIM_FUNCTION animFunc;
-  float (Anim::*animFunc)(float);
+  float (Anim::*animFunc)(float) const;
   ANIM_INFINITY preInfinity;
   ANIM_INFINITY postInfinity;
 
   bool bHasKeys;
+
+  AnimKeyFrame* currentKeyFrame;
+  AnimKeyFrame* nextKeyFrame;
   tList<AnimKeyFrame>* keyFrameList;
 };
Index: /orxonox/branches/textEngine/src/story_entities/world.cc
===================================================================
--- /orxonox/branches/textEngine/src/story_entities/world.cc	(revision 3784)
+++ /orxonox/branches/textEngine/src/story_entities/world.cc	(revision 3785)
@@ -361,6 +361,6 @@
 	    
 	    tmpAnim = new Animation<Text>(testText, &Text::setBlending);
-
-	    //	    tmpAnim->setFuncToAnim(testText, &Text::setBlending);
+	    tmpAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR);
+	    tmpAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
 	    break;
 	  }
@@ -786,5 +786,5 @@
       this->localCamera->tick(this->dt);
       this->garbageCollector->tick(seconds);
-      tmpAnim->tick(this->dt);
+      tmpAnim->tick(seconds);
     }
   this->lastFrame = currentFrame;
