[英]Rotate image counterclockwise
我有一个时针旋转的圆圈。
在这里,我尝试将其逆时针旋转:
<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();
如何逆时针旋转图像?
使用负角:
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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.