I have the following function that I want to continously animate an image as fallback for CSS animation for IE9.
Problem is it rotates once then on recursion now
always equals to 360. It never starts at 0 again.
Thanks :)
var App = {
init: function() {
console.log(Modernizr.cssanimations);
this.rotateSpinners();
},
rotateSpinners: function() {
$('.speed2').each(function() {
App.rotate($(this));
});
},
rotate: function(element) {
//console.log('---');
//console.log(element);
$(element).stop(true, true).animate(
{
rotation: 360
},
{
duration: 3600,
step: function(now) {
$(this).css({"transform": "rotate("+now+"deg)"});
//counts up to 360, second run always returns 360 without counting
console.log(now);
},
done: function() {
// tried to reset here
//$(this).css({"transform": "rotate(0deg)"});
App.rotate($(this));
}
}
);
}
};
App.init();