summaryrefslogtreecommitdiff
path: root/src/mbgl/util/transition.cpp
blob: bab5e12fddb0b89e8cc46aae815592d65ad85968 (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(const TimePoint& 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>;

}}