Changeset 3871 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 18, 2005, 3:41:54 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/track_manager.cc
r3849 r3871 394 394 // initializing the Animation for the Text. 395 395 this->textAnimation = new tAnimation<Text>(this->trackText, &Text::setBlending); 396 this->textAnimation->addKeyFrame(1.0, 3.0, ANIM_ NEG_EXP);396 this->textAnimation->addKeyFrame(1.0, 3.0, ANIM_COSINE); 397 397 this->textAnimation->addKeyFrame(0.0, .001); 398 398 this->textAnimation->setInfinity(ANIM_INF_CONSTANT); -
orxonox/trunk/src/util/animation/t_animation.h
r3868 r3871 20 20 #ifndef _T_ANIMATION_H 21 21 #define _T_ANIMATION_H 22 23 22 24 23 #include "animation.h" … … 160 159 { 161 160 tmpKeyFrame = new KeyFrameF; 161 // when adding the second frame 162 162 if (this->currentKeyFrame == this->nextKeyFrame) 163 163 this->nextKeyFrame = tmpKeyFrame; 164 164 this->keyFrameList->add(tmpKeyFrame); 165 166 }165 } 166 // when adding the first frame 167 167 else 168 168 { 169 169 tmpKeyFrame = this->keyFrameList->firstElement(); 170 bHasKeys = true;170 this->bHasKeys = true; 171 171 this->setAnimFunc(animFunc); 172 172 } 173 173 174 tmpKeyFrame->value = value; 174 175 tmpKeyFrame->duration = duration; … … 196 197 this->handleInfinity(); 197 198 this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 199 198 200 printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value); 199 201 this->setAnimFunc(this->currentKeyFrame->animFunc); … … 264 266 float tAnimation<T>::linear(float timePassed) const 265 267 { 266 return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) 268 return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) 267 269 * (timePassed / this->currentKeyFrame->duration); 268 // PRINTF(0)("value is %f, %p %p\n", val, this->currentKeyFrame, this->nextKeyFrame);269 // return val;270 270 } 271 271 … … 277 277 float tAnimation<T>::sine(float timePassed) const 278 278 { 279 float d = this->currentKeyFrame->value - this->nextKeyFrame->value; 280 float e = 0.5 * d * (1 - cos(M_PI * timePassed / this->currentKeyFrame->duration)); 281 return this->currentKeyFrame->value - e; 279 if (timePassed * 2.0 < this->currentKeyFrame->duration) 280 return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) 281 * sin( M_PI * timePassed / this->currentKeyFrame->duration)/2; 282 else 283 return this->nextKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value) 284 * sin( M_PI * (1.0 - timePassed / this->currentKeyFrame->duration))/2; 282 285 /* 283 return his->currentKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value)284 * sin(timePassed / this->currentKeyFrame->duration * M_PI);286 printf("::%f::::%f::\n",timePassed/this->currentKeyFrame->duration,retVal); 287 return retVal; 285 288 */ 286 289 } … … 293 296 float tAnimation<T>::cosine(float timePassed) const 294 297 { 295 float d = this->currentKeyFrame->value - this->nextKeyFrame->value; 296 float e = 0.5 * d * (sin(M_PI * timePassed / this->currentKeyFrame->duration)); 297 if( timePassed > 0.5*this->currentKeyFrame->duration) e = (d - e); 298 return this->currentKeyFrame->value - e; 299 /* 300 return this->currentKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value) 301 * cos(timePassed / this->currentKeyFrame->duration * M_PI); 302 */ 298 return ((this->nextKeyFrame->value + this->currentKeyFrame->value) + 299 (this->currentKeyFrame->value - this->nextKeyFrame->value) * 300 cos( M_PI * timePassed / this->currentKeyFrame->duration))/2; 303 301 } 304 302
Note: See TracChangeset
for help on using the changeset viewer.