blob: 5a65277a7b5f3b67c3fe0ec90fba79516572a558 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include "map/alfa_animation_task.hpp"
#include "map/framework.hpp"
AlfaAnimationTask::AlfaAnimationTask(double start, double end,
double timeInterval, double timeOffset,
Framework * f)
: m_start(start)
, m_end(end)
, m_current(start)
, m_timeInterval(timeInterval)
, m_timeOffset(timeOffset)
, m_f(f)
{
}
bool AlfaAnimationTask::IsHiding() const
{
return m_start > m_end;
}
float AlfaAnimationTask::GetCurrentAlfa() const
{
return m_current;
}
void AlfaAnimationTask::OnStart(double ts)
{
m_timeStart = ts;
BaseT::OnStart(ts);
m_f->Invalidate();
}
void AlfaAnimationTask::OnStep(double ts)
{
BaseT::OnStep(ts);
double const elapsed = ts - (m_timeStart + m_timeOffset);
if (elapsed >= 0.0)
{
double const t = elapsed / m_timeInterval;
if (t > 1.0)
{
m_current = m_end;
End();
}
else
m_current = m_start + t * (m_end - m_start);
}
m_f->Invalidate();
}
|