Let me explain the problem. I'm creating a phonegap application and I have some css animations running. The animation in question is a hand moving onto the screen and when it reaches 300px down the screen to then animate backwards.
CSS:
.handmovedown{
transform: translateY(300px);
-webkit-transform: translateY(300px); /** Safari & Chrome **/
-o-transform: translateY(300px); /** Opera **/
-moz-transform: translateY(300px); /** Firefox **/
}
.handmoveup{
transform: translateY(-300px);
-webkit-transform: translateY(-300px); /** Safari & Chrome **/
-o-transform: translateY(-300px); /** Opera **/
-moz-transform: translateY(-300px); /** Firefox **/
}
.objecttransition{
transition: all 0.5s linear;
-webkit-transition: all 0.5s linear; /** Chrome & Safari **/
-moz-transition: all 0.5s linear; /** Firefox **/
-o-transition: all 0.5s linear; /** Opera **/
}
As we can see the handmovedown makes the hand move down and the handmoveup makes the hand move up. Now the objecttransition makes sure that each animation that runs takes 0.5s. Here is my JS:
$(document).ready(
function()
{
$("#Hand").addClass("handmovedown");
$("#Logo").addClass("logomove");
setInterval(function(){$("#Hand").addClass("handmoveup");},700);
});
Now the code above adds the handmovedown then 700 milliseconds later the handmoveup is added to the hand the the hand moves backwards. Everything in the BROWSER works fine. When I put it in phonegap and run it on Android. The handmovedown takes longer than 0.5 seconds to run and then the handmoveup kicks in and the animation looks odd. My question is how would I measure how long the handmovedown took so that the handmoveup could wait the right amount of time before it triggers?