Javascript 逆时针旋转图像
我有一个时针旋转的圆圈 这里我试着逆时针旋转它:Javascript 逆时针旋转图像,javascript,jquery,Javascript,Jquery,我有一个时针旋转的圆圈 这里我试着逆时针旋转它: <img src='http://aprilzero.com/static/images/rings_desktop/1.png'> var $circle = $("img"), degree = 0, timer; var x = "-" + degree + 'deg'; function rotate(x) { $circle.css({ WebkitTransform : 'rotate(x)',
<img src='http://aprilzero.com/static/images/rings_desktop/1.png'>
var $circle = $("img"), degree = 0, timer;
var x = "-" + degree + 'deg';
function rotate(x) {
$circle.css({ WebkitTransform : 'rotate(x)',
'-webkit-transition-duration': '0.5s'
});
timer = setTimeout(function() {
++degree; rotate();
},100);
}
rotate();
变量$circle=$(“img”),度=0,定时器;
var x=“-”+度+deg”;
函数旋转(x){
$circle.css({webkitttransform:'rotate(x)',
“-webkit转换持续时间”:“0.5s”
});
计时器=设置超时(函数(){
++度;旋转();
},100);
}
旋转();
如何逆时针旋转图像
使用负角度:
var $circle = $("img"), degree = 0, timer;
function rotate() {
$circle.css({ WebkitTransform : 'rotate(' + degree + 'deg)',
'-webkit-transition-duration': '0.5s'
});
timer = setTimeout(function() {
--degree; rotate();
},100);
}
rotate();