diff options
Diffstat (limited to 'transitionworkerthread.cpp')
-rw-r--r-- | transitionworkerthread.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/transitionworkerthread.cpp b/transitionworkerthread.cpp index 2ee1d0e..e002be6 100644 --- a/transitionworkerthread.cpp +++ b/transitionworkerthread.cpp @@ -1,13 +1,16 @@ +#include <chrono> +#include <thread> + #include "transitionworkerthread.h" // The full duration (usecs) of the restoration animation static const double DURATION = 250000; -// The time to wait (usecs) before the next animation tick -static const double TICK_TIME = DURATION / 60.0; - // The amount to increase 't' per time step -static const double TICK_SIZE = TICK_TIME / DURATION; +static const double TICK_SIZE = 1.0 / 60.0; + +// The time to wait (usecs) before the next animation tick +static const std::chrono::microseconds TICK_TIME(DURATION * TICK_SIZE); TransitionWorkerThread::TransitionWorkerThread(TransitionControl *control) : m_control(control) @@ -28,7 +31,7 @@ void TransitionWorkerThread::run() while (t + TICK_SIZE < 1.0) { t += TICK_SIZE; m_control->setT(m_easing.valueForProgress(t)); - QThread::usleep(TICK_TIME); + std::this_thread::sleep_for(TICK_TIME); } m_control->setT(1.0); |