function animate (obj) {
var start = +new Date();
var timer = setInterval(function(){
var progress = (+new Date() - start) obj.delay// время анимации
if(progress > 1) progress = 1;
obj.fn(progress);
if(progress == 1) clearInterval(timer):
}, 20)
}
window.onload = animate({
delay: 500,
element: document.getElementById('div'),
fn: function (progress) {
this.element.style.top = 50 * progress + 'px';
}