#include "interpolation.h" void Interpolation::start(int length, double amount) { start_ = progress_; dest_ = amount; length_ = length; thus_ = 0; } void Interpolation::tick(double dt) { if (progress_ != dest_) { thus_ += dt; if (thus_ >= length_) { thus_ = length_; } progress_ = (dest_ - start_) / length_ * thus_ + start_; } }