本文介绍了jQuery平滑动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个动画,使屏幕上的节拍"按钮变了.效果很好,这是一件事,动画太锐利"而不平滑,我该如何平滑呢?
I have this animation that makes some buttons on screen 'beat'. It works fine exept one thing, the animation is too 'sharp' and not smooth, how can I smooth it?
function myFunction() { setInterval(function () { tstFnc(); }, 1000); } var flag = true; function tstFnc() { var numM = Math.floor((Math.random() * 10) + 1); var stringM = '#mgf_main' + numM + ' img'; $(stringM).animate({ width: '80px', height: '80px' }, 150, function () { $(stringM).animate({ width: '68px', height: '68px' }, 150, function () { // nothing }); }); };推荐答案
您可以在动画选项上设置easing属性.
You can set the easing property on the animate options.
api.jquery/animate/
easings/
更多推荐
jQuery平滑动画
发布评论