fix(core): check if star gets out of screen
This commit is contained in:
@@ -81,6 +81,12 @@ export class Background {
|
|||||||
star.y += star.vy;
|
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
|
// Stern zeichnen mit Scroll-Parallax
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(star.x, star.y - this.scrollY * this.parallaxFactor, star.radius, 0, Math.PI * 2);
|
ctx.arc(star.x, star.y - this.scrollY * this.parallaxFactor, star.radius, 0, Math.PI * 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user