So currently I have an animation of a bouncing object which is playing at 20 times a second
1000/50 = 20 times a second
The code is the following, you can assume all variables have been initialized properly
var animation = setInterval(function () {
currentFrame++;
if (speedX <= 0.0) {
clearInterval(animation);
}
speedX -= 0.03;
speedY = (speedY + Math.sqrt((2 * currentFrame) / gravityPull));
yPosition += speedY;
if (yPosition > groundY) {
speedY *= -1;
yPosition = groundY;
}
xPosition += speedX;
$("#box").offset({ top: yPosition, left: xPosition });
}, 50);
This is creating a really clugish performance in IE, even though Chrome seems to be completely fine with this code running. In fact its so bad, that it slows down much of the computer.
Is there something wrong here? It seems like the computations are fairly simple... The frame rate is not very high, 20 per second is not extreme but is still fluid enough for a not so choppy animation.