- Timestamp:
- Apr 13, 2005, 2:17:16 AM (20 years ago)
- Location:
- orxonox/branches/textEngine/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/animation.cc
r3785 r3786 33 33 34 34 // setting default values 35 this->localTime = 0.0; 35 36 this->animFunc = &Anim::linear; 36 37 this->currentKeyFrame = tmpKeyFrame; … … 70 71 if (this->currentKeyFrame == this->nextKeyFrame) 71 72 this->nextKeyFrame = tmpKeyFrame; 73 this->keyFrameList->add(tmpKeyFrame); 74 72 75 } 73 76 else … … 80 83 tmpKeyFrame->animFunc = animFunc; 81 84 82 this->keyFrameList->add(tmpKeyFrame);83 85 } 84 86 … … 106 108 this->animFunc = &Anim::sine; 107 109 break; 108 109 110 } 110 111 } … … 112 113 113 114 // animation functions 114 float Anim::random(float time ) const115 float Anim::random(float timePassed) const 115 116 { 116 117 return (float)rand()/(float)RAND_MAX; 117 118 } 118 119 119 float Anim::constant(float time ) const120 float Anim::constant(float timePassed) const 120 121 { 121 122 return this->currentKeyFrame->value; 122 123 } 123 124 124 float Anim::linear(float time ) const125 float Anim::linear(float timePassed) const 125 126 { 126 127 return this->nextKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value) 127 * (time *100.0/ this->currentKeyFrame->duration);128 * (timePassed / this->currentKeyFrame->duration); 128 129 // PRINTF(0)("value is %f, %p %p\n", val, this->currentKeyFrame, this->nextKeyFrame); 129 130 // return val; 130 131 } 131 132 132 float Anim::sine(float time ) const133 float Anim::sine(float timePassed) const 133 134 { 134 135 135 136 } -
orxonox/branches/textEngine/src/animation.h
r3785 r3786 66 66 67 67 // animation functions 68 float random(float time ) const;69 float constant(float time ) const;70 float linear(float time ) const;71 float sine(float time ) const;68 float random(float timePassed) const; 69 float constant(float timePassed) const; 70 float linear(float timePassed) const; 71 float sine(float timePassed) const; 72 72 73 73 … … 79 79 80 80 bool bHasKeys; 81 bool bPlay; 81 82 83 float localTime; 82 84 AnimKeyFrame* currentKeyFrame; 83 85 AnimKeyFrame* nextKeyFrame; … … 137 139 void Animation<T>::tick(float time) 138 140 { 139 (this->object->*(funcToAnim))((this->*animFunc)(time)); 141 this->localTime += time; 142 if (localTime >= this->currentKeyFrame->duration) 143 { 144 this->localTime = 0; 145 this->currentKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 146 this->nextKeyFrame = this->keyFrameList->nextElement(this->nextKeyFrame); 147 printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value); 148 149 150 } 151 152 (this->object->*(funcToAnim))((this->*animFunc)(this->localTime)); 140 153 } 141 154 -
orxonox/branches/textEngine/src/story_entities/world.cc
r3785 r3786 361 361 362 362 tmpAnim = new Animation<Text>(testText, &Text::setBlending); 363 tmpAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR); 364 tmpAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR); 363 365 tmpAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR); 364 366 tmpAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
Note: See TracChangeset
for help on using the changeset viewer.