這是一個旋轉漸變背景。 http://jsfiddle.net/f5v5d/
HTML
<div id="bgwrap"><div id="bg"></div></div>
<h3>Fancy Backgrounds For Everyone!</h3>
CSS
#bgwrap {
position:fixed;
left:0;top:0;right:0;bottom:0;
overflow: visible;
z-index:-1;
}
#bg {
position:absolute;
left:0;top:0;width:100%;height:100%;
padding:0;margin:0;
border-radius: 50%;
background: linear-gradient(45deg, red, gray, red);
animation: spin 5s linear infinite;
-moz-animation: spin 5s linear infinite;
-webkit-animation: spin 5s linear infinite;
-ms-animation: spin 5s linear infinite;
}
@keyframes spin {
from { transform: scale3d(2,2,1) rotateZ(0deg); }
to { transform: scale3d(2,2,1) rotateZ(360deg); }
}
@-moz-keyframes spin {
from { -moz-transform: scale3d(2,2,1) rotateZ(0deg); }
to { -moz-transform: scale3d(2,2,1) rotateZ(360deg); }
}
@-webkit-keyframes spin {
from { -webkit-transform: scale3d(2,2,1) rotateZ(0deg); }
to { -webkit-transform: scale3d(2,2,1) rotateZ(360deg); }
}
@-ms-keyframes spin {
from { -ms-transform: scale3d(2,2,1) rotateZ(0deg); }
to { -ms-transform: scale3d(2,2,1) rotateZ(360deg); }
}
應該是什麼動畫的第二_state_?我的意思是,梯度應該從我們在代碼中看到的動畫變成..什麼? – matewka