0

在IOS平台上:

HTML5 画布元素不是硬件加速的。CSS3 3D 变换(例如:)translate3d是硬件加速的。

想要使用带有 PhoneGap 的 HTML/JavaScript 为 IOS 创建 2d 游戏,我应该考虑只使用带有 CSS3 的 DOM 吗?

有没有人试过这个?有没有基准?

4

3 回答 3

2

接受的答案实际上是极具误导性的,问题的一部分也是如此。直截了当:

  • iOS 5 及更高版本实际上确实为 Canvas 使用了硬件加速。
  • 画布根本没有设计得很好。仅当您应用转换时,硬件加速才会启动。如果您清除并重绘,即使使用 requestAnimationFrame,您的性能也可能会很不稳定。你肯定会注意到差异。
  • CSS3 转换可能会产生更好的性能 - 对于 Android 设备。
于 2013-02-12T00:32:24.647 回答
2

在构建自己的 2D 游戏时,我也有这个顾虑。我最初在 iOS 上遇到动画性能问题,但我通过 CSS3 3D 转换解决了这个问题。我没有尝试过 Canvas,但一旦应用了正确的 CSS,我就真的不需要了。在 iOS 和 Android 版本下,PhoneGap 的性能仍然不错。一些较旧的 Android 设备有点慢,但我认为 Canvas 也无济于事。

至于基准测试,我确实发现它显示了带有图像的 Canvas 和 CSS3 过渡:http ://www.spielzeugz.de/html5/compare/

于 2012-08-23T00:51:10.520 回答
0

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.

于 2012-06-29T19:08:44.267 回答