// Vom Hauptprozess aufgerufen: das Bild des fertigen Fensters von der Mitte aus aufziehen. // Liefert true, wenn die Animation durchgelaufen ist, sonst false. window.aufbauen = (bildAdresse) => new Promise((fertig) => { const bild = document.getElementById('fenster'); bild.onerror = () => fertig(false); bild.onload = () => { const v = Math.max(0, innerHeight / 2 - 66); const h = Math.max(0, innerWidth / 2 - 66); bild.style.visibility = 'visible'; document.body.classList.add('aufbau'); bild.animate([ { clipPath: `inset(${v}px ${h}px round 30px)`, opacity: 0.2 }, { opacity: 1, offset: 0.25 }, { clipPath: 'inset(0px 0px round 0px)', opacity: 1 } ], { duration: 560, easing: 'cubic-bezier(.2, .8, .2, 1)', fill: 'forwards' }) .finished.then(() => fertig(true), () => fertig(false)); }; bild.src = bildAdresse; });