0
我现在正在努力使三个球正弦波,每个球是一个div。我使用CSS3关键帧来创建动画。令人遗憾的是,球似乎与随机偏移计时。我想留在JS的方式,但是,如果有必要我明白。正弦球动画CSS3
我现在的JS小提琴是:here
HTML结构:
<div id="background">
<div id="ball_1" class="ball"></div>
<div id="ball_2" class="ball"></div>
<div id="ball_3" class="ball"></div>
</div>
的CSS:
@-webkit-keyframes color_change {
0% {background-color: red;}
25% {background-color: yellow;}
50% {background-color: orange;}
75% {background-color: green;}
100% {background-color: blue;}
}
@-webkit-keyframes bounce {
0% {transform: translateY(0px);}
50% {transform: translateY(50px);}
100%{transform: translateY(0px);}
}
#background{
background-color: #000;
height: 100px;
}
.ball{
width: 35px;
height: 35px;
border-radius: 35px;
background-color: #FFF;
display: inline-block;
}
#ball_1{
-webkit-animation: bounce 4s infinite;
}
#ball_2{
-webkit-animation: bounce 3.5s infinite;
}
#ball_3{
-webkit-animation: bounce 3s infinite;
}
完美!非常感谢!我还是新来的CSS3动画;所以,这是很棒的信息! – NateAGeek 2014-12-01 20:07:03