![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinDRthC9CQ3xWcNQRXcNXC9ow4zsGIS1zUMZf8Dho_ini25Ul-5cR-IvO-vcHshrvYd8N04Irq7kqV53G-7GR-Y5rU0ympYj-byh-3ULN7dW7cHpbO2tm3LwEbpjAWOz0wEAyQ6NNSRn8/s1600/output_d3jxQS.gif)
// 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 >>>>>>>>>>...
No comments:
Post a Comment
..