可以使用關鍵幀動畫的結合做到這一點。下面的工作代碼。
#circle {
display: block;
width: 100px;
height: 100px;
background: red;
border-radius: 50%;
overflow:hidden;
/* Animation to spin and move the sphere */
-webkit-animation: spin 1000ms linear infinite, moveLeftToRight 5s linear infinite;
-moz-animation: spin 1000ms linear infinite, moveLeftToRight 5s linear infinite;
-ms-animation: spin 1000ms linear infinite, moveLeftToRight 5s linear infinite;
animation: spin 1000ms linear infinite, moveLeftToRight 5s linear infinite;
-webkit-transition: all 1s ease;
transition: all 1s ease;
position: absolute;
left: 0;
}
/* Spinning the sphere using key frames */
@keyframes spin {
from { transform: rotate3d(0, 1, 0, 0deg); }
to { transform: rotate3d(0, 1, 0, 180deg); }
}
/* Move sphere from left to right */
@keyframes moveLeftToRight {
0% { left: 0; }
100% { left: 100%; }
}
<div id="circle">
<img src="http://cdn.wallpapersafari.com/15/28/zMTLik.jpg" style="height:100px; width:100px;"/>
</div>
你能描述一下你的意思嗎? –
下面的答案几乎沒有迴應,而且問題還沒有澄清,所以我認爲這應該被擱置爲「不清楚」。 – halfer