We're trying to optimize the game, it works OK on ipad 2, but the simple sprite animation works terribly slow on retina iPad. We're using Safari browser.
We're using CSS to scale the app. At first, we tried to use the libcanvas framework but later switched to the plain HTML5 canvas. We tried to apply the -webkit-transform: translate3d(0,0,0); hack but no luck at all. We're using webkitRequestAnimationFrame method.
We do the series of drawImage:
ctx.drawImage(anim,
frame * widthFrame,
0,
widthFrame,
widthFrame,
devicePixelRatio * shape.x +0.5|0,
devicePixelRatio * shape.y +0.5|0,
devicePixelRatio * shape.width,
devicePixelRatio * shape.height);
followed by
window.webkitRequestAnimationFrame(draw,root)
The test cases: http://jsfiddle.net/LJRXb/7/ high resolution http://jsfiddle.net/AsfcL/1/ low resolution
Any ideas what can we do to improve the performance? Anything wrong with the app? Is there any better method to perform a sprite animation? Thank you for your attention and expert advice.