translate加速计算_使用translate3d在WebKit中强制进行硬件加速

本文介绍了如何通过在WebKit CSS中使用translate3d来强制硬件加速,从而减少动画闪烁,提高性能。这种方法适用于需要进行2d转换的CSS动画。应用translate3d后,如果仍有闪烁,可以通过一些不常见的CSS属性来解决问题。
摘要由CSDN通过智能技术生成

translate加速计算

Ever notice an odd flicker within WebKit-powered desktop and mobile browsers, or simply want to use hardware acceleration of a given device? There's a really neat trick you can use to force hardware acceleration!

是否曾经注意到在WebKit驱动的台式机和移动浏览器中出现奇怪的闪烁,还是只是想使用给定设备的硬件加速? 您可以使用一个非常巧妙的技巧来强制硬件加速!

WebKit CSS (The WebKit CSS)


/* warp speed ahead */
.animClass {
	-webkit-transform: translate3d(0, 0, 0);
	/* more specific animation properties here */
}


The use of translate3d pushes CSS animations into hardware acceleration. Even if you're looking to do a basic 2d translation, use translate3d for more power! If your animation is still flickering after switching to the transform above, you can use a few little-known CSS properties to try to fix the problem:

translate3d的使用将CSS动画推向了硬件加速。 即使您要进行基本的2d翻译,也可以使用translate3d来获得更多功能! 如果切换到上述变换后动画仍然闪烁,则可以使用一些鲜为人知CSS属性来尝试解决此问题:


.animClass {
	-webkit-backface-visibility: hidden;
	-webkit-perspective: 1000;
}


There you have it; more power, less flicker. Happy animating!

你有它; 更大的功率,更少的闪烁。 动画愉快!

翻译自: https://davidwalsh.name/translate3d

translate加速计算

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值