Skip to content
Browse files

Speed up the rank animation, and don't make the old value completely

disappear (which makes the animation even faster).
  • Loading branch information...
1 parent 859dc3f commit cfe93f96f27eff38de3b4bc050f362651a48ffa7 hiker committed
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/states_screens/race_gui.cpp
View
13 src/states_screens/race_gui.cpp
@@ -723,27 +723,28 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
}
}
- float scale = 1.0f;
- int rank = kart->getPosition();
- const float DURATION = 0.8f;
+ float scale = 1.0f;
+ int rank = kart->getPosition();
+ const float DURATION = 0.4f;
+ const float MIN_SHRINK = 0.3f;
if(m_animation_states[id] == AS_SMALLER)
{
scale = 1.0f - (world->getTime()-m_rank_animation_start_times[id])
/ DURATION;
rank = m_last_ranks[id];
- if(scale<0)
+ if(scale<MIN_SHRINK)
{
m_animation_states[id] = AS_BIGGER;
m_rank_animation_start_times[id] = world->getTime();
// Store the new rank
m_last_ranks[id] = kart->getPosition();
- scale = 0.0f;
+ scale = MIN_SHRINK;
}
}
else if(m_animation_states[id] == AS_BIGGER)
{
scale = (world->getTime() - m_rank_animation_start_times[id])
- / DURATION;
+ / DURATION + MIN_SHRINK;
rank = m_last_ranks[id];
if(scale>1.0f)
{

0 comments on commit cfe93f9

Please sign in to comment.
Something went wrong with that request. Please try again.