我有一個div動畫,下面是從下到上翻譯的反覆。 0px to -20px to 0px to -20px to 0px....
但我想它翻譯這樣 0px to -20px to 5px to -20px to 0px to -20px to 5px to -20px to 0px
Css動畫多重狀態
HTML
<div id="main">
<div id="example"></div>
</div>
CSS,而不是
#main{
border-bottom: 1px solid black;
}
#example{
width: 100px;
height: 100px;
border: 1px solid black;
-webkit-animation: example 0.5s linear 0s infinite alternate;
}
@-webkit-keyframes example {
from {transform:translate(0px,0px);}
to {transform:translate(0px,-20px);}
}