I would like to rotate a div in an animate function such as
$(\'div\').animate({rotate: \'30deg\'},1000);
I have found this:
http
Here's the code I used to animate scale and rotation using jQuery:
var $elem = $('#myImage');
$({ deg: 0 }).animate({ deg: 359 }, {
duration: 600,
step: function (now) {
var scale = (2 * now / 359);
$elem.css({
transform: 'rotate(' + now + 'deg) scale(' + scale + ')'
});
}
});
This basically loops from 0 to 359, rotates my image by that many degrees, and also scales between 0 and 2, so the image grows from nothing to double size during the animation.