Comments (5)
文章好,图也挺好的。
不过我觉得 生成这个元素的位图
这一部分不是很详细,可以稍微补充详细点。
所谓 生成这个元素的位图
其实是 纹理(texture)
,在 Chrome 中,存在有不同类型的层: RenderLayer(负责 DOM 子树),GraphicsLayer(负责 RenderLayer 的子树),其中 GraphicsLayer 层是作为纹理(texture)上传给 GPU 的。
这里的纹理指的是 GPU 的一个术语:可以把它想象成一个从主存储器(例如 RAM)移动到图像存储器(例如 GPU 中的 VRAM)的位图图像(bitmap image)。一旦它被移动到 GPU 中,你可以将它匹配成一个网格几何体(mesh geometry),在 Chrome 中使用纹理来从 GPU 上获得大块的页面内容。通过将纹理应用到一个非常简单的矩形网格就能很容易匹配不同的位置(position)和变形(transformation),这也就是 3D CSS 的工作原理。
而 transform 移动元素时就是移动这些生成的 GraphicsLayer 层从而避免了浏览器大量的reflow(relayout)而提升性能的。
那么一个元素什么时候会触发创建一个层?从目前来说,满足以下任意情况便会创建层:
- 3D 或透视变换(perspective、transform) CSS 属性
- 使用加速视频解码的
- 拥有 3D (WebGL) 上下文或加速的 2D 上下文的 元素
- 混合插件(如 Flash)
- 对自己的 opacity 做 CSS 动画或使用一个动画变换的元素
- 拥有加速 CSS 过滤器的元素
- 元素有一个包含复合层的后代节点(换句话说,就是一个元素拥有一个子元素,该子元素在自己的层里)
- 元素有一个 z-index 较低且包含一个复合层的兄弟元素(换句话说就是该元素在复合层上面渲染)
from cc.
对于 纹理(texture)
确实没有深入的研究过。
非常感谢,补充的很详细。
from cc.
嗯嗯 很好 学习了
from cc.
怪不得有的文章提到给css加上一个并不移动的 3D transform 就能加速。
from cc.
👍 终于比较详细的了解了所谓的 开启 GPU 加速 了
from cc.
Related Issues (20)
- 48.帮学弟做题--WebSocket和Vue的五子棋 HOT 29
- 50.Material Design 风格的 Vue.js UI 组件库 beta 版本发布
- 49.理解 Vue.js 的计算属性 HOT 1
- 51.Vue.js 组件库 Rubik UI 开发心得总结 HOT 6
- 52.2016-这一年的总结和随想 HOT 3
- 53.图解 Flexbox HOT 6
- 54.Vue.js 项目使用 Karma 做自动化UI测试小结 HOT 9
- 55.[函数式编程] 不用循环的 JavaScript HOT 6
- 56.图解 Flexbox 2 - 深入理解 HOT 10
- flex HOT 1
- 57.在 Vue 中使用全局共享的方式管理状态
- 58.ES2015 Proxy 实用代码示例&详解
- 59.适用于 vue.js 和原生 js 的渐进式图片加载 HOT 25
- 60.[半夜改bug] mongoose 的 createConnection 和 connect HOT 2
- 61.async/await 小技巧 HOT 4
- 62.Vue.js Little Tips HOT 6
- 63.CSS 伪类选择器
- 64.深度使用 JSON.stringify() HOT 14
- 65.从 Vue.js 自定义输入框深入理解 v-model HOT 4
- ccc HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cc.