double requestAnimationFrame如何工作? [英] How does double requestAnimationFrame work?

查看:117
本文介绍了double requestAnimationFrame如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在观看Google IO17时,我了解了double requestAnimationFrame方法,但我无法真正解决这个问题,也许是因为我几乎没有参与网络动画。

While watching Google IO17, I learnt about the double requestAnimationFrame method but i can't really wrap my head around it maybe because i hardly involve myself in animation on the web.

但是,我认为很高兴知道它的工作原理以及何时将事情加倍,就像Addy Osmani所设计的Twitter选项卡示例一样。谢谢!

However, i think it would nice to know how it works and when to double things up as in the case of Twitter's tab example laid out by Addy Osmani. Thanks!

推荐答案

由于错误在Chrome和其他一些应用程序中引入,每当发现要切换时,我们都必须使用两次 requestAnimationFrame 类或执行需要RAF在执行操作后触发的其他CSS动画。有点像逃生舱门,动画很好/很流畅。

Because of the bug introduced in Chrome and some others, we have to use double requestAnimationFrame whenever we find ourselves toggling classes or performing other CSS animations that requires RAF to fire after an action is performed. It's kinda like an escape hatch to have nice/smooth animation.

这篇关于double requestAnimationFrame如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆