预渲染动画 jQuery
只是想知道是否有人知道如何在 jQuery 中预渲染动画。基本上,我第一次运行动画时它很不稳定......但从那以后当我运行它时,它运行得非常流畅......
有什么想法吗?
Just wondering if anyone has any idea how I can Prerender Animations in jQuery. Basically the first time I run an animation it is jerky... but from then on when I run it, it runs perfectly smooth...
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(据我所知)没有办法做你所要求的事情。
JavaScript 动画是通过从一个 CSS 值转换到另一个 CSS 值(如边距、顶部、宽度、高度等)来完成的。我真的不明白你如何“预渲染”这个。我唯一能想到的是预先定义将在 CSS 中应用的值序列(如果您使用复杂的指数或三角函数缓动)。即便如此,这也不是您(必然)使用 jQuery 要做的事情。
你有一个让你的动画突然变得更流畅的例子吗?
There's no way (that I know of) to do what you're asking.
Javascript animations are done by transitioning from one CSS value to another (like margin, top, width, height, etc). I don't really see how you could "pre-render" this. The only thing I can think of is pre-defining the sequence of values which will be applied in CSS (if you're using complicated exponential or trigonometric functions easing). Even then, it's not something you would do (necessarily) with jQuery.
Do you have an example of your jerky animation that suddenly runs smoother?