Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS动画 #56

Open
zhouzhongyuan opened this issue May 4, 2017 · 5 comments
Open

CSS动画 #56

zhouzhongyuan opened this issue May 4, 2017 · 5 comments
Labels

Comments

@zhouzhongyuan
Copy link
Owner

zhouzhongyuan commented May 4, 2017

Property Translate Key Point Example
animation 动画 keyframes animation
transition 过度 transition: width 2s; transition demo
tranform 变换 RST tranform
@zhouzhongyuan
Copy link
Owner Author

@zhouzhongyuan
Copy link
Owner Author

  • react-native-web中页面切换使用了transform

@zhouzhongyuan
Copy link
Owner Author

zhouzhongyuan commented Oct 25, 2017

<Web动画性能指南>总结

硬件加速

近些年来,现代浏览器借助于显卡的优势改变了渲染操作:通常被笼统的称为“硬件加速(hardware acceleration)”。
以Chrome为例,在硬件加速渲染通道下,复杂的页面会被分为多个层(Layer), Chrome对各个层分别进行排版、绘图,再将绘图结果作为“纹理”上传至GPU, 由GPU完成层的3D变换(transform)等操作,最后再将GPU渲染好的层图像进行复合操作(Compesite Layers),得到最终的画面结果。 因此,通过3D变换实现的位移、旋转、缩放将不会触发浏览器重绘(除非层的内容发生改变)。
可见,可以避免重绘的层模型对于动画调优有着重大意义。

调试(Chrome)

Layer: Ctrl + Shift + P, search 'layer'

chrome-layer

@zhouzhongyuan
Copy link
Owner Author

zhouzhongyuan commented Oct 25, 2017

@zhouzhongyuan
Copy link
Owner Author

zhouzhongyuan commented Feb 26, 2018

ShrinkView

图1(toolBarExpand)
component_1
图2(collapseView)
component_2
图3(toolBarCollapse)
component_3

行为

向上滚动

图1 + 图2 -> 图3
图1 立马消失
图3 透明度逐渐降低
图2 高度逐渐变为0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant