*matrix gives you more control about the resulting transformation, using a matrix construction set.
When using it in animations however, it makes it impossible to predict how the current and target transformations are going to be interpolated; there is no way to tell whether elements are going to rotate clockwise or anti-clockwise for instance.
Relative animations are possible by prepending "+=" to the transform string.
$(elem).css('transform', 'rotate(45deg)');
// using the following syntax, elem will always rotate 90deg anticlockwise
$(elem).animate({transform: '+=rotate(-90deg)'});
Limitations:
requires jQuery 1.4.3+,
Should you use the translate property, then your elements need to be absolutely positionned in a relatively positionned wrapper or it will fail in IE,
transformOrigin is not accessible.
Why such restrictions with 'translate'?
Since translate is unavailable in IE<9, we have to emulate it using top and left properties of the element style.
This can, of course, only work if the elements are absolutely positionned in a relatively positionned wrapper.
Other plugins position the elements and wrap them transparently.
I think that transparently messing with the DOM often introduces unpredictible behavior.
Unpredictible behavior leads developpers to fear plugins. Fear leads to anger. Anger leads to hate. Hate leads to suffering.
I prefer leaving this up to you.
请发表评论