diff --git a/Tween.h b/Tween.h index c4cf46f..4e51b7c 100644 --- a/Tween.h +++ b/Tween.h @@ -50,6 +50,12 @@ private: float progress; bool isPlayingF; + void dtTick() { + uint32_t loopStartTime = millis(); + dt = (loopStartTime - oldMillis) / 1000.0; + oldMillis = loopStartTime; + } + public: void update() { if (!isPlayingF || easing == nullptr) return; @@ -63,11 +69,7 @@ public: } float current; - void dtTick() { - uint32_t loopStartTime = millis(); - dt = (loopStartTime - oldMillis) / 1000.0; - oldMillis = loopStartTime; - } + void start(float from, float to, uint16_t duration, eFunc easing) { if (from == to) { return; }