Commit 94b404f7 authored by Benjamin Gallois's avatar Benjamin Gallois

Looming animation fix

parent e62f7290
......@@ -12,25 +12,29 @@ body.addEventListener("mousemove", function (event) {
});
function loom(){
zoom ++;
var a = circle.offsetWidth;
circle.style.width = a + zoom + 'px';
circle.style.height = a + zoom + 'px';
circle.style.left = parseFloat(circle.style.left) - zoom*0.5 + 'px';
circle.style.top = parseFloat(circle.style.top) - zoom*0.5 + 'px';
if (zoom > 30){
if (zoom < 30){
zoom ++;
var a = circle.offsetWidth;
circle.style.width = a + zoom + 'px';
circle.style.height = a + zoom + 'px';
circle.style.left = parseFloat(circle.style.left) - zoom*0.5 + 'px';
circle.style.top = parseFloat(circle.style.top) - zoom*0.5 + 'px';
looming = setTimeout(loom, 100);
}
if (zoom == 30){
clearTimeout(looming);
zoom = 0;
circle.style.width = 0 + 'px';
circle.style.height = 0 + 'px';
circle.style.left = parseFloat(circle.style.left) + 465*0.5 + 'px';
circle.style.top = parseFloat(circle.style.top) + 465*0.5 + 'px';
clearInterval(looming);
}
}
body.addEventListener("click", function (event) {
looming = setInterval(loom, 50);
loom();
});
body.addEventListener("keyup", function(event) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment