让这个图标像果冻一样摆动的最好方法是什么
当您使用 YUI 动画框架和 Javascript 单击图标时,我尝试对图标应用一点“摆动”。
这就是我现在所拥有的:
var anim = new YAHOO.util.Anim(filter.Li, {top: { to: -5 }}, .10, YAHOO.util.Easing.bounceIn);
var anim2 = new YAHOO.util.Anim(filter.Li, {top: { to: 5 }}, .15, YAHOO.util.Easing.bounceBoth);
var anim3 = new YAHOO.util.Anim(filter.Li, {top: { to: 0 }}, .20, YAHOO.util.Easing.bounceOut);
anim.onComplete.subscribe(function() { anim2.animate(); });
anim2.onComplete.subscribe(function() { anim3.animate(); });
anim.animate();
首先,我必须将这么多动画链接在一起,这有点蹩脚。有更好的方法吗?另外,我对它的外观并不是很满意。它有点太流动了,我希望获得更多不稳定的外观。
有没有更好的方法来达到这种效果?谢谢!
I'm trying to apply a little "wiggle" to an icon when you click on it using the YUI animation framework and Javascript.
Here's what I have right now:
var anim = new YAHOO.util.Anim(filter.Li, {top: { to: -5 }}, .10, YAHOO.util.Easing.bounceIn);
var anim2 = new YAHOO.util.Anim(filter.Li, {top: { to: 5 }}, .15, YAHOO.util.Easing.bounceBoth);
var anim3 = new YAHOO.util.Anim(filter.Li, {top: { to: 0 }}, .20, YAHOO.util.Easing.bounceOut);
anim.onComplete.subscribe(function() { anim2.animate(); });
anim2.onComplete.subscribe(function() { anim3.animate(); });
anim.animate();
First off, it's kinda lame that I have to chain together so many animations. Is there a better way to do this? Also, I'm not really all that pleased with the way it looks. It's a bit too fluid, I'm looking to get more of a wobbly look.
Is there a better approach to do this sort of effect? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你使用递归,你可以让它变得更易读,而且我更喜欢 easyBoth 动画方法。试试这个:
You can make it a little bit readable if you use recursion and i prefere the easyBoth animation method. Try this one: