Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to CONSTANTLY rotate an object with jquery?

OKAY! Here's the situation. I've got a jQuery plugin that's animating a background-image in my header to constantly scroll left-to-right. I have a .png of a wheel sitting on this header. I need to have the wheel constantly spinning with the moving background.

CSS3- Yes I could use CSS3, but then some poor soul using Internet Explorer would see a stationary wheel on a moving background which would be weird.

jQuery Plugins- This is what I'd LIKE to use, but I have yet to find one that will constantly rotate the image. Most only rotate by a certain angle when you activate it.

If anybody has any thoughts, I'd appreciate it!

like image 318
kthornbloom Avatar asked Feb 17 '11 17:02

kthornbloom


2 Answers

You could try this:

http://code.google.com/p/jqueryrotate/wiki/Examples

    var rotation = function (){
   $("#img").rotate({
      angle:0, 
      animateTo:360, 
      callback: rotation,
      easing: function (x,t,b,c,d){        // t: current time, b: begInnIng value, c: change In value, d: duration
          return c*(t/d)+b;
      }
   });
}
rotation();
like image 99
Kaos Avatar answered Oct 03 '22 15:10

Kaos


Check out my post:

  • Rotate and Fly off elements with jQuery and CSS3
  • See the DEMO

enter image description here

like image 33
Sarfraz Avatar answered Oct 03 '22 15:10

Sarfraz