function gravity_Move(dom, start, end) {
var speedY = 0;
clearInterval(dom.timer);
dom.timer = setInterval(function () {
speedY += 3;
var toBottom = start - speedY;
if (toBottom <= end) {
speedY *= -0.8;
toBottom = end;
}
if (Math.abs(speedY) < 1) {
speedY = 0;
}
if (speedY == 0 && toBottom == end) {
clearInterval(dom.timer);
return;
}
dom.style.bottom = toBottom + "px";
start = parseInt(dom.style.bottom);
}, 20);
}
dom:元素;
start:起始位置;(y轴)
end:终点位置;(y轴)