我有,我希望有类似这种行为的元素:动画元素
也许是更容易使用这个GIF,但我的目标是使它通过脚本(或CSS),所以我想动画像“gif”类似行为的“立方体”。 到目前为止,我实现了从左向右移动“立方体”,但是我无法找到解决方法,我可以在靠近中心时减慢“立方体”,并在离开中心时加速。
HTML:
<div class="holder">
<div class="cube">
</div>
</div>
CSS:
.holder{
position:relative;
width:400px;
}
.cube{
position:absolute; display:none;background: #48a548;
width: 10px; height: 10px;
}
的Jquery:
var width = $(".holder").width();
setInterval(function() {
$(".cube").fadeIn("fast").css({ left: "0%" }).animate(
{
left: "100%"
},
width).fadeOut("slow");
}, 2500);
个