As far as I know, basic animates can't animate non-numeric CSS properties.
I believe you could get this done using a step function and the appropriate css3 transform for the users browser. CSS3 transform is a bit tricky to cover all your browsers in (IE6 you need to use the Matrix filter, for instance).
EDIT: here's an example that works in webkit browsers (Chrome, Safari): http://jsfiddle.net/ryleyb/ERRmd/
If you wanted to support IE9 only, you could use transform
instead of -webkit-transform
, or -moz-transform
would support FireFox.
The trick used is to animate a CSS property we don't care about (text-indent
) and then use its value in a step function to do the rotation:
$('#foo').animate(
..
step: function(now,fx) {
$(this).css('-webkit-transform','rotate('+now+'deg)');
}
...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…