summaryrefslogtreecommitdiff
path: root/src/helpers/AnimatedVariable.hpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-23 21:47:16 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-23 21:47:16 +0200
commit3ebe7d79722c1bdc333b236960ff136ab607a02c (patch)
tree2f6c0de1534bc789ba91e7dceca155988cfa1e2c /src/helpers/AnimatedVariable.hpp
parent306d163613c6940e73ad58e852b42cdb236a5bc4 (diff)
Added bezier curves
Diffstat (limited to 'src/helpers/AnimatedVariable.hpp')
-rw-r--r--src/helpers/AnimatedVariable.hpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp
index ccdd78e3..197e5d4e 100644
--- a/src/helpers/AnimatedVariable.hpp
+++ b/src/helpers/AnimatedVariable.hpp
@@ -16,8 +16,8 @@ class CAnimatedVariable {
public:
CAnimatedVariable(); // dummy var
- void create(ANIMATEDVARTYPE, float* speed, int64_t* enabled, void* pWindow);
- void create(ANIMATEDVARTYPE, std::any val, float* speed, int64_t* enabled, void* pWindow);
+ void create(ANIMATEDVARTYPE, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow);
+ void create(ANIMATEDVARTYPE, std::any val, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow);
~CAnimatedVariable();
@@ -60,34 +60,46 @@ public:
void operator=(const Vector2D& v) {
ASSERT(m_eVarType == AVARTYPE_VECTOR);
m_vGoal = v;
+ animationBegin = std::chrono::system_clock::now();
+ m_vBegun = m_vValue;
}
void operator=(const float& v) {
ASSERT(m_eVarType == AVARTYPE_FLOAT);
m_fGoal = v;
+ animationBegin = std::chrono::system_clock::now();
+ m_fBegun = m_fValue;
}
void operator=(const CColor& v) {
ASSERT(m_eVarType == AVARTYPE_COLOR);
m_cGoal = v;
+ animationBegin = std::chrono::system_clock::now();
+ m_cBegun = m_cValue;
}
- // Sets the actual stored value, without affecting the goal
+ // Sets the actual stored value, without affecting the goal, but resets the timer
void setValue(const Vector2D& v) {
ASSERT(m_eVarType == AVARTYPE_VECTOR);
m_vValue = v;
+ animationBegin = std::chrono::system_clock::now();
+ m_vBegun = m_vValue;
}
- // Sets the actual stored value, without affecting the goal
+ // Sets the actual stored value, without affecting the goal, but resets the timer
void setValue(const float& v) {
ASSERT(m_eVarType == AVARTYPE_FLOAT);
m_fValue = v;
+ animationBegin = std::chrono::system_clock::now();
+ m_vBegun = m_vValue;
}
- // Sets the actual stored value, without affecting the goal
+ // Sets the actual stored value, without affecting the goal, but resets the timer
void setValue(const CColor& v) {
ASSERT(m_eVarType == AVARTYPE_COLOR);
m_cValue = v;
+ animationBegin = std::chrono::system_clock::now();
+ m_vBegun = m_vValue;
}
// Sets the actual value and goal
@@ -140,12 +152,19 @@ private:
float m_fGoal = 0;
CColor m_cGoal;
+ Vector2D m_vBegun = Vector2D(0,0);
+ float m_fBegun = 0;
+ CColor m_cBegun;
+
float* m_pSpeed = nullptr;
int64_t* m_pEnabled = nullptr;
void* m_pWindow = nullptr;
+ std::string* m_pBezier = nullptr;
bool m_bDummy = true;
+ std::chrono::system_clock::time_point animationBegin;
+
ANIMATEDVARTYPE m_eVarType = AVARTYPE_INVALID;
friend class CAnimationManager;