Skip to content

Commit 6c57697

Browse files
committed
✨ Optimize starfield and grid line generation for improved performance and visual clarity
1 parent 07e59ef commit 6c57697

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/card-renderer.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class CardRenderer {
2828
}
2929

3030
// Generate starfield with animations (reduced count for smaller SVG)
31-
const stars = Array.from({ length: 50 }, (_, i) => {
31+
const stars = Array.from({ length: 25 }, (_, i) => {
3232
const x = (Math.random() * width).toFixed(0);
3333
const y = (Math.random() * height).toFixed(0);
3434
const r = (Math.random() * 1.5 + 0.5).toFixed(1);
@@ -40,7 +40,7 @@ export class CardRenderer {
4040
}).join('');
4141

4242
// Generate shooting stars (simplified)
43-
const shootingStars = Array.from({ length: 2 }, (_, i) => {
43+
const shootingStars = Array.from({ length: 1 }, (_, i) => {
4444
const startX = (Math.random() * width).toFixed(0);
4545
const startY = (Math.random() * (height / 2)).toFixed(0);
4646
const endX = (parseFloat(startX) + 250).toFixed(0);
@@ -54,7 +54,7 @@ export class CardRenderer {
5454
}).join('');
5555

5656
// Generate orbital rings
57-
const orbitRings = [120, 160, 200, 240].map((r, i) =>
57+
const orbitRings = [120, 180, 240].map((r, i) =>
5858
`<circle cx="${centerX}" cy="${centerY}" r="${r}" fill="none" stroke="rgba(0,200,255,${(0.15 - i * 0.03).toFixed(2)})" stroke-width="1" stroke-dasharray="10,8"/>`
5959
).join('');
6060

@@ -216,12 +216,12 @@ export class CardRenderer {
216216
217217
<!-- Grid lines (subtle) -->
218218
<g opacity="0.1">
219-
${Array.from({ length: 20 }, (_, i) => {
220-
const x = (i + 1) * (width / 20);
219+
${Array.from({ length: 12 }, (_, i) => {
220+
const x = (i + 1) * (width / 12);
221221
return `<line x1="${x}" y1="0" x2="${x}" y2="${height}" stroke="#00c8ff" stroke-width="0.5"/>`;
222222
}).join('')}
223-
${Array.from({ length: 10 }, (_, i) => {
224-
const y = (i + 1) * (height / 10);
223+
${Array.from({ length: 6 }, (_, i) => {
224+
const y = (i + 1) * (height / 6);
225225
return `<line x1="0" y1="${y}" x2="${width}" y2="${y}" stroke="#00c8ff" stroke-width="0.5"/>`;
226226
}).join('')}
227227
</g>
@@ -244,8 +244,6 @@ export class CardRenderer {
244244
245245
<!-- Ping animation rings -->
246246
<circle cx="${centerX}" cy="${centerY}" r="80" fill="none" stroke="#00c8ff54" stroke-width="2" opacity="0"><animate attributeName="r" values="80;150;220" dur="5s" repeatCount="indefinite"/><animate attributeName="opacity" values="0.7;0.3;0" dur="5s" repeatCount="indefinite"/></circle>
247-
<circle cx="${centerX}" cy="${centerY}" r="80" fill="none" stroke="#00c8ff54" stroke-width="2" opacity="0"><animate attributeName="r" values="80;150;220" dur="5s" begin="1s" repeatCount="indefinite"/><animate attributeName="opacity" values="0.7;0.3;0" dur="5s" begin="1s" repeatCount="indefinite"/></circle>
248-
<circle cx="${centerX}" cy="${centerY}" r="80" fill="none" stroke="#00c8ff54" stroke-width="2" opacity="0"><animate attributeName="r" values="80;150;220" dur="5s" begin="2s" repeatCount="indefinite"/><animate attributeName="opacity" values="0.7;0.3;0" dur="5s" begin="2s" repeatCount="indefinite"/></circle>
249247
</g>
250248
251249
<!-- Top left panel - User info -->

0 commit comments

Comments
 (0)