From 021f0b32a13e97b317781be523502ee96a81efed Mon Sep 17 00:00:00 2001 From: Mononaut Date: Sun, 11 Aug 2024 20:52:26 +0000 Subject: [PATCH] sparklier sparkles --- .../acceleration-sparkles.component.ts | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/components/acceleration/sparkles/acceleration-sparkles.component.ts b/frontend/src/app/components/acceleration/sparkles/acceleration-sparkles.component.ts index bde7eb8ed..2316c996d 100644 --- a/frontend/src/app/components/acceleration/sparkles/acceleration-sparkles.component.ts +++ b/frontend/src/app/components/acceleration/sparkles/acceleration-sparkles.component.ts @@ -41,23 +41,25 @@ export class AccelerationSparklesComponent implements OnChanges { doSparkle(): void { if (this.run) { const now = performance.now(); - if (now - this.lastSparkle > 30) { + if (now - this.lastSparkle > 20) { this.lastSparkle = now; if (this.arrow?.nativeElement && this.sparkleAnchor?.nativeElement) { const anchor = this.sparkleAnchor.nativeElement.getBoundingClientRect().right; const right = this.arrow.nativeElement.getBoundingClientRect().right; - const dx = (anchor - right) + 37.5; - this.sparkles.push({ - style: { - right: dx + 'px', - top: (Math.random() * 30) + 'px', - animationDelay: (Math.random() * 50) + 'ms', - }, - rotation: { - transform: `rotate(${Math.random() * 360}deg)`, - } - }); - while (this.sparkles.length > 100) { + const dx = (anchor - right) + 30; + const numSparkles = Math.ceil(Math.random() * 3); + for (let i = 0; i < numSparkles; i++) { + this.sparkles.push({ + style: { + right: (dx + (Math.random() * 10)) + 'px', + top: (15 + (Math.random() * 30)) + 'px', + }, + rotation: { + transform: `rotate(${Math.random() * 360}deg)`, + } + }); + } + while (this.sparkles.length > 200) { this.sparkles.shift(); } this.cd.markForCheck();