Spaces:
Running
Running
Update stars.js
Browse files
stars.js
CHANGED
@@ -325,7 +325,7 @@
|
|
325 |
ctx.globalAlpha = p.life;
|
326 |
ctx.fillStyle = p.color;
|
327 |
ctx.beginPath();
|
328 |
-
ctx.arc(p.x, p.y, p.size * p.life, 0, Math.PI * 2);
|
329 |
ctx.fill();
|
330 |
});
|
331 |
|
@@ -344,10 +344,11 @@
|
|
344 |
const twinkle = 0.5 + 0.5 * Math.sin(s.twPhase);
|
345 |
const pulse = 0.8 + 0.2 * Math.sin(s.pulsePhase);
|
346 |
const alpha = (s.twRange + (1 - s.twRange) * twinkle) * pulse;
|
347 |
-
const ds = (1 - s.z/width) * s.originalSize * 2 * pulse;
|
348 |
|
349 |
ctx.globalAlpha = alpha;
|
350 |
-
|
|
|
351 |
});
|
352 |
});
|
353 |
ctx.globalCompositeOperation = "source-over";
|
@@ -369,7 +370,7 @@
|
|
369 |
gradient.addColorStop(1, `hsla(${c.hue - 40}, 100%, 50%, ${segAlpha * 0.2})`);
|
370 |
|
371 |
ctx.strokeStyle = gradient;
|
372 |
-
ctx.lineWidth = Math.max(1, seg2.size * (i/c.segments.length) * c.alpha);
|
373 |
ctx.beginPath();
|
374 |
ctx.moveTo(seg1.x, seg1.y);
|
375 |
ctx.lineTo(seg2.x, seg2.y);
|
@@ -380,10 +381,10 @@
|
|
380 |
// Warp pulses with enhanced rings
|
381 |
pulses.forEach(p => {
|
382 |
ctx.beginPath();
|
383 |
-
ctx.arc(p.x, p.y, p.r, 0, Math.PI * 2);
|
384 |
const gradient = ctx.createRadialGradient(
|
385 |
-
p.x, p.y, p.r - p.thickness/2,
|
386 |
-
p.x, p.y, p.r + p.thickness/2
|
387 |
);
|
388 |
gradient.addColorStop(0, `hsla(${p.hue}, 100%, 90%, ${p.alpha})`);
|
389 |
gradient.addColorStop(0.3, `hsla(${p.hue - 10}, 100%, 70%, ${p.alpha * 0.8})`);
|
@@ -391,16 +392,17 @@
|
|
391 |
gradient.addColorStop(1, `hsla(${p.hue - 30}, 100%, 30%, 0)`);
|
392 |
|
393 |
ctx.strokeStyle = gradient;
|
394 |
-
ctx.lineWidth = p.thickness;
|
395 |
ctx.stroke();
|
396 |
|
397 |
// Add inner glow
|
398 |
if (p.alpha > 0.3) {
|
|
|
399 |
ctx.beginPath();
|
400 |
-
ctx.arc(p.x, p.y,
|
401 |
const innerGradient = ctx.createRadialGradient(
|
402 |
p.x, p.y, 0,
|
403 |
-
p.x, p.y,
|
404 |
);
|
405 |
innerGradient.addColorStop(0, `hsla(${p.hue + 20}, 100%, 100%, ${p.alpha * 0.5})`);
|
406 |
innerGradient.addColorStop(1, `hsla(${p.hue}, 100%, 70%, 0)`);
|
|
|
325 |
ctx.globalAlpha = p.life;
|
326 |
ctx.fillStyle = p.color;
|
327 |
ctx.beginPath();
|
328 |
+
ctx.arc(p.x, p.y, Math.max(0.1, p.size * p.life), 0, Math.PI * 2);
|
329 |
ctx.fill();
|
330 |
});
|
331 |
|
|
|
344 |
const twinkle = 0.5 + 0.5 * Math.sin(s.twPhase);
|
345 |
const pulse = 0.8 + 0.2 * Math.sin(s.pulsePhase);
|
346 |
const alpha = (s.twRange + (1 - s.twRange) * twinkle) * pulse;
|
347 |
+
const ds = Math.max(0.1, (1 - s.z/width) * s.originalSize * 2 * pulse);
|
348 |
|
349 |
ctx.globalAlpha = alpha;
|
350 |
+
const drawSize = Math.max(0.1, ds * 2);
|
351 |
+
ctx.drawImage(sprite, x - ds, y - ds, drawSize, drawSize);
|
352 |
});
|
353 |
});
|
354 |
ctx.globalCompositeOperation = "source-over";
|
|
|
370 |
gradient.addColorStop(1, `hsla(${c.hue - 40}, 100%, 50%, ${segAlpha * 0.2})`);
|
371 |
|
372 |
ctx.strokeStyle = gradient;
|
373 |
+
ctx.lineWidth = Math.max(0.1, seg2.size * (i/c.segments.length) * c.alpha);
|
374 |
ctx.beginPath();
|
375 |
ctx.moveTo(seg1.x, seg1.y);
|
376 |
ctx.lineTo(seg2.x, seg2.y);
|
|
|
381 |
// Warp pulses with enhanced rings
|
382 |
pulses.forEach(p => {
|
383 |
ctx.beginPath();
|
384 |
+
ctx.arc(p.x, p.y, Math.max(0.1, p.r), 0, Math.PI * 2);
|
385 |
const gradient = ctx.createRadialGradient(
|
386 |
+
p.x, p.y, Math.max(0.1, p.r - p.thickness/2),
|
387 |
+
p.x, p.y, Math.max(0.1, p.r + p.thickness/2)
|
388 |
);
|
389 |
gradient.addColorStop(0, `hsla(${p.hue}, 100%, 90%, ${p.alpha})`);
|
390 |
gradient.addColorStop(0.3, `hsla(${p.hue - 10}, 100%, 70%, ${p.alpha * 0.8})`);
|
|
|
392 |
gradient.addColorStop(1, `hsla(${p.hue - 30}, 100%, 30%, 0)`);
|
393 |
|
394 |
ctx.strokeStyle = gradient;
|
395 |
+
ctx.lineWidth = Math.max(0.1, p.thickness);
|
396 |
ctx.stroke();
|
397 |
|
398 |
// Add inner glow
|
399 |
if (p.alpha > 0.3) {
|
400 |
+
const innerRadius = Math.max(0.1, p.r * 0.3);
|
401 |
ctx.beginPath();
|
402 |
+
ctx.arc(p.x, p.y, innerRadius, 0, Math.PI * 2);
|
403 |
const innerGradient = ctx.createRadialGradient(
|
404 |
p.x, p.y, 0,
|
405 |
+
p.x, p.y, innerRadius
|
406 |
);
|
407 |
innerGradient.addColorStop(0, `hsla(${p.hue + 20}, 100%, 100%, ${p.alpha * 0.5})`);
|
408 |
innerGradient.addColorStop(1, `hsla(${p.hue}, 100%, 70%, 0)`);
|