<legend id='n08by'><style id='n08by'><dir id='n08by'><q id='n08by'></q></dir></style></legend>
      1. <i id='n08by'><tr id='n08by'><dt id='n08by'><q id='n08by'><span id='n08by'><b id='n08by'><form id='n08by'><ins id='n08by'></ins><ul id='n08by'></ul><sub id='n08by'></sub></form><legend id='n08by'></legend><bdo id='n08by'><pre id='n08by'><center id='n08by'></center></pre></bdo></b><th id='n08by'></th></span></q></dt></tr></i><div id='n08by'><tfoot id='n08by'></tfoot><dl id='n08by'><fieldset id='n08by'></fieldset></dl></div>

        <small id='n08by'></small><noframes id='n08by'>

          <bdo id='n08by'></bdo><ul id='n08by'></ul>
      2. <tfoot id='n08by'></tfoot>

        为什么硬件加速的 CSS 动画花费太多“复合层"?主线程中的时间?

        时间:2023-09-04
          <bdo id='17WRj'></bdo><ul id='17WRj'></ul>

            <tfoot id='17WRj'></tfoot>
            <i id='17WRj'><tr id='17WRj'><dt id='17WRj'><q id='17WRj'><span id='17WRj'><b id='17WRj'><form id='17WRj'><ins id='17WRj'></ins><ul id='17WRj'></ul><sub id='17WRj'></sub></form><legend id='17WRj'></legend><bdo id='17WRj'><pre id='17WRj'><center id='17WRj'></center></pre></bdo></b><th id='17WRj'></th></span></q></dt></tr></i><div id='17WRj'><tfoot id='17WRj'></tfoot><dl id='17WRj'><fieldset id='17WRj'></fieldset></dl></div>

                    <tbody id='17WRj'></tbody>

                  <legend id='17WRj'><style id='17WRj'><dir id='17WRj'><q id='17WRj'></q></dir></style></legend>

                  <small id='17WRj'></small><noframes id='17WRj'>

                • 本文介绍了为什么硬件加速的 CSS 动画花费太多“复合层"?主线程中的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我用一张大图(33440 x 440)对大图进行变换,然后实现类似帧动画的动画;我还使用 translate3D 来获得 GPU 加速,

                  I use a big picture(33440 x 440) and transform the big image, then achieve a animation like as frame animation; and also I use the translate3D to get a GPU Acceleration,

                  下面的简化代码:

                    @keyframes testName {
                      0% { transform: translate3d(0,0,0); }
                      100% { transform: translate3d(-33440px,0,0); }
                    }
                  

                  众所周知,复合层的工作将转移到 GPU;但是在性能的chrome devtools中,主线程中复合层的任务花费了太多时间:(解码图像发生在光栅线程而不是主线程中)

                  as we know, the work of composite layers will move to GPU; but in chrome devtools of performance, the task of composite layers in main thread cost too much time: (decode image happens in raster thread not in main thread)

                  那么为什么任务复合层在主线程中做了什么?

                  so why and what the taskcomposite layers did in main thread?

                  推荐答案

                  问题是你的图片太大了.合成图层"大致是指将页面上的所有元素(图层)以正确的顺序和位置相互叠加,如果这些图层很大,这将需要很长时间.仅仅因为它发生在 GPU 上并不意味着如果你将 14 兆像素的图像投入其中,它就会立即发生.

                  The problem is that your image is HUGE. "Compositing layers" roughly means rendering all of the elements (layers) on the page on top of each other in the correct order and location, which will take a long time if these layers are gigantic. Just because it's happening on the GPU doesn't mean it will happen instantly if you throw a 14 megapixel image into it.

                  这篇关于为什么硬件加速的 CSS 动画花费太多“复合层"?主线程中的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何让 onBeforeAction 调用等到内部的函数调用在meteor.js中完成? 下一篇:React Hooks 和 useState 的使用

                  相关文章

                  <legend id='F8Rdn'><style id='F8Rdn'><dir id='F8Rdn'><q id='F8Rdn'></q></dir></style></legend>
                  <tfoot id='F8Rdn'></tfoot>
                  1. <i id='F8Rdn'><tr id='F8Rdn'><dt id='F8Rdn'><q id='F8Rdn'><span id='F8Rdn'><b id='F8Rdn'><form id='F8Rdn'><ins id='F8Rdn'></ins><ul id='F8Rdn'></ul><sub id='F8Rdn'></sub></form><legend id='F8Rdn'></legend><bdo id='F8Rdn'><pre id='F8Rdn'><center id='F8Rdn'></center></pre></bdo></b><th id='F8Rdn'></th></span></q></dt></tr></i><div id='F8Rdn'><tfoot id='F8Rdn'></tfoot><dl id='F8Rdn'><fieldset id='F8Rdn'></fieldset></dl></div>
                      <bdo id='F8Rdn'></bdo><ul id='F8Rdn'></ul>

                    <small id='F8Rdn'></small><noframes id='F8Rdn'>