async function MovePreviousBackground(Left) {
const transitionPromise = () => {
return new Promise(resolve => {
ActiveBackground.addEventListener('transitionend', function handler() {
resolve();
ActiveBackground.removeEventListener('transitionend', handler);
});
});
};
const applyTransition = async (transform) => {
ActiveBackground.style.transition = `0.5s ease`;
ActiveBackground.style.transform = transform;
await transitionPromise();
};
if (Left) {
if (ActiveBackground.Value < 15) {
await applyTransition(`translate(-100%, 0%)`);
console.log("11");
} else {
await applyTransition(`translate(-100%, 0%)`);
await applyTransition(`translate(-100%, -100%)`);
await applyTransition(`translate(100%, -100%)`);
await applyTransition(`translate(100%, 0%)`);
console.log("10");
}
} else {
if (ActiveBackground.Value < 15) {
await applyTransition(`translate(100%, 0%)`);
await applyTransition(`translate(100%, -100%)`);
await applyTransition(`translate(-100%, -100%)`);
await applyTransition(`translate(-100%, 0%)`);
console.log("01");
} else {
await applyTransition(`translate(100%, 0%)`);
console.log("00");
}
}
}