var af = AccelerationFunctions; var ani = sstchur.web.Animation; var o = $('obj1'); o.style.top = '0'; var bounceFn = new ani.AccelerationFunction(function(pc) { var ret; if (pc <= .5) { ret = af.ExponentialAcc.getValue(pc); } else if (pc > .5 && pc <= .75) { ret = -((af.ExponentialAcc.getValue(1-pc))); } else { ret = (af.ExponentialAcc.getValue(pc-.5)); } return ret; }); var i; var factor = 100 / bounceFn.getTotal(); for (i = 0; i <= 100; i++) { var y = bounceFn.getValue(i/100) * factor; setTimeout(move(y/2), i*12); } function move(val) { return function() { o.style.top = Math.round(val) + 'px'; } }