加速效果:增加重力值,随着定时器的执行,重力增大
回弹效果:当抵达目标位置时,将速度改为负值
回弹减速:将速度改变为负值的同时,乘以一个小数减少其速度
效果图:
html样式实现:
<style type="text/css">
.cont{
width: 1000px;
height: 600px;
background: #eee;
margin: 20px auto;
position: relative;
}
.box{width: 100px;height: 100px;background: red;position: absolute;left: 0;border-radius: 50%;}
</style>
css标签创建:
<div class="cont">
<div class="box"></div>
</div>
js代码: