jQuery 缓动:如何将动画链接在一起作为一个缓动动画?
我有两个动画,我想将它们分组为一个动画,以便缓动将延续并继续到下一个动画。第二个动画需要在第一个动画完成后开始。这是我到目前为止所拥有的,但是当第二个动画开始时缓动开始(这是我所期望的)。
$progressBar.animate({width: progressBarWidth + '%'}, barAnimationSpeed, 'swing', function(){
$overGoalBar.animate({width: overGoalBarWidth + '%'}, barAnimationSpeed, 'swing', function(){});
});
如何将这些动画组合成一个缓动动画?
I have two animations that I would like to group as one animation so that the easing will carry over and continue into the next animation. The second animation needs to start after the first one has finished. This is what I have so far, but the easing starts over when the second animation begins (which is what I would have expected).
$progressBar.animate({width: progressBarWidth + '%'}, barAnimationSpeed, 'swing', function(){
$overGoalBar.animate({width: overGoalBarWidth + '%'}, barAnimationSpeed, 'swing', function(){});
});
Here's an example of how it works right now.
How can I group these animations into one easing animation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您想演示动态创建的具有缓动效果的进度条百分比值。
我会使用服务器创建的背景图像
,并将该图像设置为 CSS 中一个 DIV 标签的背景。
最后,只需为该 DIV 标签设置一次动画即可。
如果我理解正确的话,这个想法可能会奏效。
If you want to demonstrate dynamically created percentage value of progress bar with easing effect.
I would use server created background Image
and set that image as background of one DIV tag in CSS.
Lastly just animate that one DIV tag once.
If I have understood you correctly, this idea might work.
这是一个很棒的在线工具,用于编写自定义缓动函数...
http://www .timotheegroleau.com/Flash/experiments/easing_function_generator.htm
另外,这里有更多关于缓动的一般信息...如果您有缓动插件,则不需要缓动插件缓动函数。从其中包含的链接中,您可以看到每个演示,然后与其背后的缓动函数进行比较...
如何向此 jQuery 动画添加加速?
Here is a great online tool for writing a custom easing function...
http://www.timotheegroleau.com/Flash/experiments/easing_function_generator.htm
Also, here is more information in general about easing... you do not need the easing plugin if you have an easing function. From the links contained within, you can see a demo of each and then compare to the easing function behind it...
How can I add aceleration to this jQuery animation?
您尝试过使用
线性
吗?值得注意的是,它确实将两个动画链接在一起,但它确实使它变得平滑。
http://jsfiddle.net/dkBMA/11/
Have you tried using
linear
?It's note exactly chaining two animations together, but it does smooth it out.
http://jsfiddle.net/dkBMA/11/