我想知道以最佳方式围绕中心点使元素沿着圆形运动的动画方法是什么?
我还没有完全弄清楚... :(
提前感谢。
Neuroflux.
我还没有完全弄清楚... :(
提前感谢。
Neuroflux.
我能想到的最简单的方法是:
简单演示:
var elem = $('h1:eq(0)')
.append('<span id="round" style="position:absolute;background-color:red;"> </span>')
.css('position','relative')
.find('span#round');
var i = 0;
setInterval(function(){
++i;
elem.css({'left': Math.sin(i * 0.02) * 100, 'top': Math.cos(i * 0.02) * 100});}, 100);
在jsfiddle上查看它的运作。
$.path is undefined
的错误。看起来是由于 NoScript 中的 nosniff 阻止造成的。 - Brock Adams