【问题标题】:translate3d+scale does not repaint on chrome 51translate3d+scale 不会在 chrome 51 上重绘
【发布时间】:2016-10-26 20:00:57
【问题描述】:

在 chrome 51 上,为什么 translate3d+scale 在没有过渡的情况下会变得模糊?错误或预期? https://jsfiddle.net/hkzxwomy/2/

翻译+缩放或单独缩放不会发生这种情况

container.style.transform = `translate3d(10px, 10px, 10px) scale(${scale})`;

【问题讨论】:

    标签: google-chrome css-transitions css-animations css-transforms


    【解决方案1】:

    从 Chrome 53 开始,如果元素有 will-change,它将保持这种行为,没有它,Chrome 会重新光栅化它

    更多:https://www.chromestatus.com/feature/5637351992721408

    演示:http://jsbin.com/vutotadido/1/edit?html,css,output

    解释:https://docs.google.com/document/d/1f8WS99F9GORWP_m74l_JfsTHgCrHkbEorHYu72D4Xag/edit#

    【讨论】:

    • 链接的 Google 文档帮助解决了我的问题。在我的例子中,我调用requestAnimationFrame 并使用一个函数来设置style.transform = "none",然后在该回调中设置另一个requestAnimationFrame 以删除style.transform = "" 的属性。这导致重新光栅化消除了模糊。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-15
    • 1970-01-01
    • 2018-02-10
    • 1970-01-01
    • 1970-01-01
    • 2016-09-04
    • 2015-10-13
    相关资源
    最近更新 更多