Subscribe to:
Posts (Atom)
// Box CSS: #box { background-color: red; width: 20px; height: 20px; position: absolute; left: 0; top: 10 }
function animate() {
var box = document.getElementById('box'),
duration = 1000,
start = (new Date).valueOf(),
finish = start + duration,
interval;
interval = setInterval(function() {
var time = (new Date).valueOf(), frame = time > finish ? 1 : (time - start) / duration;
// The thing being animated
box.style.left = frame * 100 + 'px';
if (time > finish) {
clearInterval(interval);
}
}, 10);
}
// Box CSS: #box { background-color: red; width: 20px; height: 20px; position: absolute; left: 0; top: 10 }
function animate() {
var box = document.getElementById('box'),
duration = 1000,
start = (new Date).valueOf(),
finish = start + duration,
interval;
interval = setInterval(function() {
var time = (new Date).valueOf(), frame = time > finish ? 1 : (time - start) / duration;
// The thing being animated
box.style.left = frame * 100 + 'px';
if (time > finish) {
clearInterval(interval);
}
}, 10);
}
Follow us on facebook
Popular Posts
-
Advertising Put your adverties our blog site Our Advertising Rates 195×275 >>>>>>>>>>...