Update particles-background.component.ts
All checks were successful
Build, Test & Push Frontend / quality-check (push) Successful in 1m38s
Build, Test & Push Frontend / docker (push) Successful in 1m41s

This commit is contained in:
2026-02-23 10:08:36 +01:00
parent b61eb4eb73
commit 885e609082

View File

@@ -1,4 +1,4 @@
import {AfterViewInit, Component, ElementRef, HostListener, NgZone, OnDestroy, ViewChild} from '@angular/core';
import {AfterViewInit, Component, ElementRef, HostListener, inject, NgZone, OnDestroy, ViewChild} from '@angular/core';
@Component({
selector: 'app-particles-background',
@@ -9,6 +9,8 @@ import {AfterViewInit, Component, ElementRef, HostListener, NgZone, OnDestroy, V
export class ParticleBackgroundComponent implements AfterViewInit, OnDestroy {
@ViewChild('canvas', { static: true }) canvasRef!: ElementRef<HTMLCanvasElement>;
private readonly ngZone = inject(NgZone);
private ctx!: CanvasRenderingContext2D;
private particles: any[] = [];
private animationFrameId: number = 0;
@@ -18,8 +20,6 @@ export class ParticleBackgroundComponent implements AfterViewInit, OnDestroy {
private readonly maxDistance = 150;
private readonly particleSpeed = 0.8;
constructor(private readonly ngZone: NgZone) {}
ngAfterViewInit(): void {
const canvas = this.canvasRef.nativeElement;
this.ctx = canvas.getContext('2d')!;