rename animation => transition

This commit is contained in:
Konstantin Käfer
2014-04-30 14:46:28 +02:00
parent 52cd9a6561
commit 449f403e87
9 changed files with 78 additions and 79 deletions

View File

@@ -48,8 +48,8 @@ public:
void resize(uint16_t width, uint16_t height, float ratio = 1);
void resize(uint16_t width, uint16_t height, float ratio, uint16_t fb_width, uint16_t fb_height);
// Animations
void cancelAnimations();
// Transition
void cancelTransitions();
// Position
void moveBy(double dx, double dy, double duration = 0);

View File

@@ -1,7 +1,7 @@
#ifndef LLMR_MAP_TRANSFORM
#define LLMR_MAP_TRANSFORM
#include <llmr/util/animation.hpp>
#include <llmr/util/transition.hpp>
#include <llmr/util/noncopyable.hpp>
#include <llmr/util/uv.hpp>
@@ -48,10 +48,10 @@ public:
void startScaling();
void stopScaling();
// Animations
bool needsAnimation() const;
void updateAnimations(time now);
void cancelAnimations();
// Transitions
bool needsTransition() const;
void updateTransitions(time now);
void cancelTransitions();
// Transform state
const TransformState currentState() const;
@@ -76,7 +76,7 @@ private:
// you render a new frame.
TransformState current;
// This reflects the final position of the transform, after all possible animations took place.
// This reflects the final position of the transform, after all possible transition took place.
TransformState final;
// Limit the amount of zooming possible on the map.
@@ -87,10 +87,10 @@ private:
// cache values for spherical mercator math
double zc, Bc, Cc;
std::forward_list<std::shared_ptr<util::animation>> animations;
std::shared_ptr<util::animation> scale_timeout;
std::shared_ptr<util::animation> rotate_timeout;
std::shared_ptr<util::animation> pan_timeout;
std::forward_list<std::shared_ptr<util::transition>> transitions;
std::shared_ptr<util::transition> scale_timeout;
std::shared_ptr<util::transition> rotate_timeout;
std::shared_ptr<util::transition> pan_timeout;
};
}

View File

@@ -1,7 +1,7 @@
#ifndef LLMR_UTIL_RASTER
#define LLMR_UTIL_RASTER
#include <llmr/util/animation.hpp>
#include <llmr/util/transition.hpp>
#include <llmr/util/texturepool.hpp>
#include <string>
@@ -29,10 +29,10 @@ public:
// loaded status
bool isLoaded() const;
// animations
void beginFadeInAnimation();
bool needsAnimation() const;
void updateAnimations(time now);
// transitions
void beginFadeInTransition();
bool needsTransition() const;
void updateTransitions(time now);
inline void setData(const std::string &img) { data = img; }
@@ -71,8 +71,8 @@ private:
// the raw pixels
char *img = nullptr;
// fade in animation
std::shared_ptr<util::animation> fade_animation = nullptr;
// fade in transition
std::shared_ptr<util::transition> fade_transition = nullptr;
};
}

View File

@@ -1,5 +1,5 @@
#ifndef LLMR_UTIL_ANIMATION
#define LLMR_UTIL_ANIMATION
#ifndef LLMR_UTIL_TRANSITION
#define LLMR_UTIL_TRANSITION
#include <llmr/util/noncopyable.hpp>
#include <llmr/util/time.hpp>
@@ -7,14 +7,14 @@
namespace llmr {
namespace util {
class animation : private noncopyable {
class transition : private noncopyable {
public:
enum state {
running,
complete
};
inline animation(time start, time duration)
inline transition(time start, time duration)
: start(start),
duration(duration) {}
@@ -23,20 +23,20 @@ public:
}
virtual state update(time now) const = 0;
virtual ~animation();
virtual ~transition();
protected:
const time start, duration;
};
class ease_animation : public animation {
class ease_transition : public transition {
public:
// Disable automatic casts.
template <typename T1, typename T2>
inline ease_animation(double from, double to, double& value, T1 start, T2 duration) = delete;
inline ease_transition(double from, double to, double& value, T1 start, T2 duration) = delete;
// Actual constructor.
ease_animation(double from, double to, double& value, time start, time duration);
ease_transition(double from, double to, double& value, time start, time duration);
state update(time now) const;
private:
@@ -45,7 +45,7 @@ private:
};
template <typename T>
class timeout : public animation {
class timeout : public transition {
public:
// Disable automatic casts.
template <typename T1, typename T2>
@@ -53,7 +53,7 @@ public:
// Actual constructor.
timeout(T final_value, T& value, time start, time duration)
: animation(start, duration),
: transition(start, duration),
final_value(final_value),
value(value) {}