Speed up the rank animation, and don't make the old value completely
disappear (which makes the animation even faster).
This commit is contained in:
parent
859dc3fbbd
commit
cfe93f96f2
@ -723,27 +723,28 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
int rank = kart->getPosition();
|
int rank = kart->getPosition();
|
||||||
const float DURATION = 0.8f;
|
const float DURATION = 0.4f;
|
||||||
|
const float MIN_SHRINK = 0.3f;
|
||||||
if(m_animation_states[id] == AS_SMALLER)
|
if(m_animation_states[id] == AS_SMALLER)
|
||||||
{
|
{
|
||||||
scale = 1.0f - (world->getTime()-m_rank_animation_start_times[id])
|
scale = 1.0f - (world->getTime()-m_rank_animation_start_times[id])
|
||||||
/ DURATION;
|
/ DURATION;
|
||||||
rank = m_last_ranks[id];
|
rank = m_last_ranks[id];
|
||||||
if(scale<0)
|
if(scale<MIN_SHRINK)
|
||||||
{
|
{
|
||||||
m_animation_states[id] = AS_BIGGER;
|
m_animation_states[id] = AS_BIGGER;
|
||||||
m_rank_animation_start_times[id] = world->getTime();
|
m_rank_animation_start_times[id] = world->getTime();
|
||||||
// Store the new rank
|
// Store the new rank
|
||||||
m_last_ranks[id] = kart->getPosition();
|
m_last_ranks[id] = kart->getPosition();
|
||||||
scale = 0.0f;
|
scale = MIN_SHRINK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(m_animation_states[id] == AS_BIGGER)
|
else if(m_animation_states[id] == AS_BIGGER)
|
||||||
{
|
{
|
||||||
scale = (world->getTime() - m_rank_animation_start_times[id])
|
scale = (world->getTime() - m_rank_animation_start_times[id])
|
||||||
/ DURATION;
|
/ DURATION + MIN_SHRINK;
|
||||||
rank = m_last_ranks[id];
|
rank = m_last_ranks[id];
|
||||||
if(scale>1.0f)
|
if(scale>1.0f)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user