always start animations with a common start time

fixes #134
This commit is contained in:
Konstantin Käfer
2014-04-14 19:30:09 -04:00
parent 2e86f2582f
commit 9bb88711b8
8 changed files with 50 additions and 55 deletions

View File

@@ -3,6 +3,7 @@
#include <memory>
#include <cassert>
#include <llmr/platform/platform.hpp>
#include <llmr/platform/gl.hpp>
#include <png.h>
@@ -176,15 +177,16 @@ void Raster::bind(bool linear) {
}
void Raster::beginFadeInAnimation() {
fade_animation = std::make_shared<util::ease_animation>(opacity, 1.0, opacity, 0.25);
double start = platform::elapsed();
fade_animation = std::make_shared<util::ease_animation>(opacity, 1.0, opacity, start, 0.25);
}
bool Raster::needsAnimation() const {
return fade_animation != nullptr;
}
void Raster::updateAnimations() {
if (fade_animation->update() == util::animation::complete) {
void Raster::updateAnimations(double time) {
if (fade_animation->update(time) == util::animation::complete) {
fade_animation = nullptr;
}
}