summaryrefslogtreecommitdiff
path: root/src/mbgl/util/transition.cpp
blob: e63a5c311f396eb188d55ac6e94e8bfd5b9253af (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
#include <mbgl/util/transition.hpp>
#include <mbgl/util/unitbezier.hpp>
#include <mbgl/util/interpolate.hpp>
#include <mbgl/platform/platform.hpp>

namespace mbgl { namespace util {

UnitBezier ease(0, 0, 0.25, 1);

transition::~transition() {}

template <typename T>
transition::state ease_transition<T>::update(timestamp now) const {
    float t = progress(now);
    if (t >= 1) {
        value = to;
        return complete;
    } else {
        value = interpolate(from, to, ease.solve(t, 0.001));
        return running;
    }
}

template class ease_transition<double>;

}}