Unsolved With QML how do I get a timed event that is accurate enough for animating frames of a Canvas
-
With C++ I could just use a thread that would call a method based on a measurement of time. QML itself as far as I know does not have something like this. The Timer object will speed up and slow down at a rate that does not look good. Finding what time it is I do not have a problem with.
-
@AI_Messiah You might try to normalize every timer shoot by calculating elapsed time exactly:
Timer { id: timer property real elap: 0 property real lag: 0 property int exactInterval: 100 running: true repeat: true interval: exactInterval onRunningChanged: { if (running) { // reset elap = 0; lag = 0 } } onTriggered: { var currTime = new Date().getTime() if (elap > 0) { // skip first shoot elap = currTime - elap lag += elap - interval } elap = currTime interval = exactInterval - lag lag = 0 } }