$('.window').animate({
right: ((x*100)+(x*8-10)-100)
}, 1000);
(()=>{
let element = document.querySelector('.window');
if (!element) return;
let right = parseInt(element.style.right) || 0;
let right_target = ((x*100)+(x*8-10)-100);
let tm_start = performance.now();
let id = setInterval(()=>{
let diff = Math.min(performance.now() - now, 1000);
let right_current = Math.round(right + (right_target - right) * diff * 0.001);
element.style.right = right_current + 'px';
if (diff >= 1000) clearInterval(id);
},10);
})();