fix(core): check if star gets out of screen

This commit is contained in:
2025-08-21 02:04:01 +02:00
parent 8d8aee3fbd
commit ebb45d2ea0

View File

@@ -81,6 +81,12 @@ export class Background {
star.y += star.vy;
}
// Bildschirm-Ränder
if (star.x < 0) star.x = this.width;
if (star.x > this.width) star.x = 0;
if (star.y < 0) star.y = document.body.scrollHeight;
if (star.y > document.body.scrollHeight) star.y = 0;
// Stern zeichnen mit Scroll-Parallax
ctx.beginPath();
ctx.arc(star.x, star.y - this.scrollY * this.parallaxFactor, star.radius, 0, Math.PI * 2);