【发布时间】:2011-09-27 22:00:30
【问题描述】:
WebKit 是使用 OpenGL 来渲染 CSS 过渡,还是使用软件渲染?
【问题讨论】:
标签: opengl css webkit css-transitions
WebKit 是使用 OpenGL 来渲染 CSS 过渡,还是使用软件渲染?
【问题讨论】:
标签: opengl css webkit css-transitions
WebKit 只是一个前端。这取决于后端和硬件支持。谷歌浏览器使用skia作为后端,它可以使用软件或硬件。所以答案是它取决于后端的实现和运行它的硬件。
【讨论】:
据我所知,唯一使用转换的硬件加速属性是 translate3d transform。
例如:
// Normal
div{
-webkit-transition: all 0.5s ease-out;
}
// Adding class to animate
div.transformed{
-webkit-transform: translate3d(100px, 100px, 0);
}
如果您只使用translate 转换或动画任何其他属性,则不会进行硬件加速。
【讨论】:
translate3d 而不是translate,造成这种差异的原因之一是因为在 Safari 中实现 translate 的时间比 translate3d 早得多。跨度>