0

看起来 jQueryRotate 插件中的默认缓动不是线性的。图像在旋转结束时会减速。所以如果我使用递归函数图像不会均匀旋转。

例子:

这是代码:

HTML:

<div id="rotate_me" style="border: 1px solid red; width: 100px; height: 100px"></div>

JS:

var rotation = function (){
   jQuery("#rotate_me").rotate({
      angle: 0,
      animateTo:360,
      duration: 1600,
      callback: rotation
   });
}
rotation();
4

2 回答 2

1

我找到了解决方案 - 它是添加参数:

easing: function (x,t,b,c,d){ 
          return c*(t/d)+b;
      }

进入旋转功能。

关于缓动功能的描述你可以在这里看到:

什么是缓动函数?

于 2013-06-03T05:32:35.560 回答
-1

仅使用 CSS3 非常简单:LIVE DEMO
可能您可以在这几行中找到答案吗?
(这个是给FF的,对于其他的。添加-browser-specific属性)

img {
  animation-duration: 3s;
  animation-name: wowrotate;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

@keyframes wowrotate{
  from { 
     transform: rotate(0deg);
  }
  to {
     transform: rotate(360deg);
  }
}
于 2013-06-02T17:18:35.427 回答