From ebb45d2ea0c4a12db9a5a1f5e72360005b266d60 Mon Sep 17 00:00:00 2001 From: Nico Haider Date: Thu, 21 Aug 2025 02:04:01 +0200 Subject: [PATCH] fix(core): check if star gets out of screen --- src/app/core/components/background/background.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/core/components/background/background.ts b/src/app/core/components/background/background.ts index 66a566b..a3d0263 100644 --- a/src/app/core/components/background/background.ts +++ b/src/app/core/components/background/background.ts @@ -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);