diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-05-10 14:32:27 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-05-12 10:38:41 +0300 |
commit | e0bcea617784d3c783b3b30b5baa8d6254e59d3f (patch) | |
tree | bb671c2a4945facbb80a8b13d946da8454cdd903 /drape_frontend/animation_system.hpp | |
parent | dc89ff76b781142125c032f80ab26380a3bea891 (diff) |
Fixed map-follow animation blending
Diffstat (limited to 'drape_frontend/animation_system.hpp')
-rw-r--r-- | drape_frontend/animation_system.hpp | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/drape_frontend/animation_system.hpp b/drape_frontend/animation_system.hpp index e61162a166..754d580583 100644 --- a/drape_frontend/animation_system.hpp +++ b/drape_frontend/animation_system.hpp @@ -166,6 +166,8 @@ public: virtual void Advance(double elapsedSeconds); virtual void Finish(); + bool IsActive() const; + bool IsFinished() const; void SetMaxDuration(double maxDuration); void SetMinDuration(double minDuration); @@ -174,11 +176,13 @@ public: protected: double GetT() const; double GetElapsedTime() const; + void SetActive(bool active); private: double m_elapsedTime; double m_duration; double m_delay; + bool m_isActive; }; class PositionInterpolator: public Interpolator @@ -186,6 +190,7 @@ class PositionInterpolator: public Interpolator using TBase = Interpolator; public: + PositionInterpolator(); PositionInterpolator(double duration, double delay, m2::PointD const & startPosition, m2::PointD const & endPosition); @@ -211,7 +216,7 @@ public: void Advance(double elapsedSeconds) override; void Finish() override; - virtual m2::PointD GetPosition() const { return m_position; } + m2::PointD GetPosition() const { return m_position; } private: m2::PointD m_startPosition; @@ -224,6 +229,7 @@ class ScaleInterpolator: public Interpolator using TBase = Interpolator; public: + ScaleInterpolator(); ScaleInterpolator(double startScale, double endScale); ScaleInterpolator(double delay, double startScale, double endScale); @@ -233,11 +239,11 @@ public: void Advance(double elapsedSeconds) override; void Finish() override; - virtual double GetScale() const { return m_scale; } + double GetScale() const { return m_scale; } private: - double const m_startScale; - double const m_endScale; + double m_startScale; + double m_endScale; double m_scale; }; @@ -246,6 +252,7 @@ class AngleInterpolator: public Interpolator using TBase = Interpolator; public: + AngleInterpolator(); AngleInterpolator(double startAngle, double endAngle); AngleInterpolator(double delay, double startAngle, double endAngle); AngleInterpolator(double delay, double duration, double startAngle, double endAngle); @@ -256,11 +263,11 @@ public: void Advance(double elapsedSeconds) override; void Finish() override; - virtual double GetAngle() const { return m_angle; } + double GetAngle() const { return m_angle; } private: - double const m_startAngle; - double const m_endAngle; + double m_startAngle; + double m_endAngle; double m_angle; }; @@ -389,9 +396,9 @@ public: void SetMaxScaleDuration(double maxDuration); private: - drape_ptr<AngleInterpolator> m_angleInterpolator; - drape_ptr<PositionInterpolator> m_positionInterpolator; - drape_ptr<ScaleInterpolator> m_scaleInterpolator; + AngleInterpolator m_angleInterpolator; + PositionInterpolator m_positionInterpolator; + ScaleInterpolator m_scaleInterpolator; TObjectProperties m_properties; TAnimObjects m_objects; }; @@ -474,6 +481,8 @@ public: bool GetProperty(TObject object, TProperty property, PropertyValue & value) const override; + bool HasScale() const; + private: double CalculateDuration() const; @@ -572,13 +581,29 @@ public: void FinishAnimations(Animation::Type type, bool rewind, bool finishAll); void FinishObjectAnimations(Animation::TObject object, bool rewind, bool finishAll); + template<typename T> T const * FindAnimation(Animation::Type type) const + { + for (auto & animations : m_animationChain) + { + for (auto const & anim : animations) + { + if (anim->GetType() == type) + { + ASSERT(dynamic_cast<T const *>(anim.get()) != nullptr, ()); + return static_cast<T const *>(anim.get()); + } + } + } + return nullptr; + } + void Advance(double elapsedSeconds); ScreenBase const & GetLastScreen() { return m_lastScreen; } void SaveAnimationResult(Animation const & animation); private: - AnimationSystem(); + AnimationSystem() = default; bool GetProperty(Animation::TObject object, Animation::TProperty property, Animation::PropertyValue & value) const; |