【发布时间】:2018-02-15 12:58:14
【问题描述】:
<img src="http://i.imgur.com/uUYXqAv.png">
img {
width: 100%;
}
我想让地球旋转。
【问题讨论】:
标签: javascript jquery css animation jquery-animate
<img src="http://i.imgur.com/uUYXqAv.png">
img {
width: 100%;
}
我想让地球旋转。
【问题讨论】:
标签: javascript jquery css animation jquery-animate
下面是我的代码。我的jsFiddle。
img {
width: 100%;
animation: rotate 60s ease infinite;
-webkit-animation: rotate 60s ease infinite;
}
@keyframes rotate{
100%{ transform: rotate(360deg); }
}
@-webkit-keyframes rotate{
100%{ transform: rotate(360deg); }
}
<img src="http://i.imgur.com/uUYXqAv.png">
【讨论】:
您可以使用设置变量的脚本,然后让函数设置间隔来旋转图片。
var start = 0;
$(document).ready(function() {
setInterval(function() {
$("picture").rotate(start);
}, 100);
});
【讨论】:
您可以使用 CSS 转换。
img {
transform:rotate(ydeg);
}
(y 是 0 到 360 之间的任意数字)
如果你想为它制作动画,你可以使用关键帧 - https://codepen.io/quangogage/pen/OjYvNG?editors=1111
【讨论】:
您好,您可以使用关键帧:
img {
position: absolute;
width: 100%;
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
看这里:
【讨论】: