我知道你可以通过对'transform‘属性应用一个转换来强制GPU加速来实现屏幕上元素的平滑动画,例如:
elem.style.transition = 'all 3s ease-out';
elem.style.transform = 'translateX(600px)';
但我想知道如果将第二行替换为:
elem.style.left = '600px';
GPU加速是否会在"left“(或"top")属性中起作用,或者它必须在transform属性上?在我看来,它应该是GPU加速的,但我无法从我读过的任何文档中收集到最终的答案。
发布于 2012-03-12 13:02:32
它不是加速的。您必须使用特定的CSS3属性才能使其可加速。我想你会发现这些链接很有趣:
http://www.html5rocks.com/en/tutorials/speed/html5/
http://www.chromium.org/developers/design-documents/gpu-accelerated-compositing-in-chrome
Does animating the value of a CSS3 transform with javascript rule out hardware acceleration?
发布于 2012-03-12 12:51:21
我收集到的共识是,只有translate3d
属性在mobile Safari等移动设备上是硬件加速的。
Further Reading。
https://stackoverflow.com/questions/9661876
复制相似问题