它仅适用于旋转,或仅适用于刻度,但不适用于两者。
$({rotation: 0, scale: 1}).animate({
rotation: 360,
scale: 3
}, {
duration: 4000,
step: function (now, fx) {
var rot, scl;
if (fx.prop === 'rotation') {
rot = now;
}
if (fx.prop === 'scale') {
scl = now;
}
$('.inner').css('transform', 'scale(' + scl + ') rotate(' + rot + 'deg)');
}
});
inner只是外部div元素中的h1标记。
答案 0 :(得分:0)
试试这个:
step: function (now, fx) {
$('#inner').css('transform', 'scale(' + now + ') rotate(' + now + 'deg)');
}
rot = now;
和scl = now;
都使用来自步骤函数参数的now
。