在IOS平台上:
HTML5 画布元素不是硬件加速的。CSS3 3D 变换(例如:)translate3d
是硬件加速的。
想要使用带有 PhoneGap 的 HTML/JavaScript 为 IOS 创建 2d 游戏,我应该考虑只使用带有 CSS3 的 DOM 吗?
有没有人试过这个?有没有基准?
在IOS平台上:
HTML5 画布元素不是硬件加速的。CSS3 3D 变换(例如:)translate3d
是硬件加速的。
想要使用带有 PhoneGap 的 HTML/JavaScript 为 IOS 创建 2d 游戏,我应该考虑只使用带有 CSS3 的 DOM 吗?
有没有人试过这个?有没有基准?
接受的答案实际上是极具误导性的,问题的一部分也是如此。直截了当:
在构建自己的 2D 游戏时,我也有这个顾虑。我最初在 iOS 上遇到动画性能问题,但我通过 CSS3 3D 转换解决了这个问题。我没有尝试过 Canvas,但一旦应用了正确的 CSS,我就真的不需要了。在 iOS 和 Android 版本下,PhoneGap 的性能仍然不错。一些较旧的 Android 设备有点慢,但我认为 Canvas 也无济于事。
至于基准测试,我确实发现它显示了带有图像的 Canvas 和 CSS3 过渡:http ://www.spielzeugz.de/html5/compare/
I made an attempt but lost interest. It seemed to be just as efficient as doing the same thing I was doing with canvases. You're not going to notice much difference unless you're doing heavy javascript calculations which you will probably be doing regardless of whether you use CSS3 or canvas.
I don't know of any benchmarks but you can read about it here: http://www.sencha.com/blog/apple-ios-5-html5-developer-scorecard/
It is also going to depend on which device you're talking about. They all run different hardware and slightly different software so that should affect your decision: http://www.codefessions.com/2012/03/how-fast-is-html5-canvas-part-2.html
Canvas is pretty well designed, in a way such that it isn't going to make much of a difference whether you hardware accelerate it or not, especially if you're just doing 2d stuff.