From efe5ac4a16de7f78824ac89dc987ef635afa5267 Mon Sep 17 00:00:00 2001 From: lelgenio Date: Fri, 21 Mar 2025 23:20:36 -0300 Subject: [PATCH] fix square fireworks --- particles.js | 12 ++++++++---- script.js | 13 ------------- 2 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 script.js diff --git a/particles.js b/particles.js index f37b7b3..697b92b 100644 --- a/particles.js +++ b/particles.js @@ -3,13 +3,17 @@ export class Particle { constructor(x, y, color) { this.x = x; this.y = y; - this.velocityX = (Math.random() - 0.5) * 5; - this.velocityY = (Math.random() - 0.5) * 5; + + const directionRadians = Math.random() * Math.PI * 2; + const speed = Math.random() * 3; + + this.velocityX = Math.cos(directionRadians) * speed; + this.velocityY = Math.sin(directionRadians) * speed; this.size = Math.random() * 4 + 1; // Tamanho maior para melhor visibilidade this.color = color; this.alpha = 1; - this.gravity = 0.05; - this.resistance = 0.96; + this.gravity = 0.01; + this.resistance = 0.99; } update() { diff --git a/script.js b/script.js deleted file mode 100644 index b562e56..0000000 --- a/script.js +++ /dev/null @@ -1,13 +0,0 @@ -// Código das partículas -class Particle { - // ... código da classe Particle -} - -// Código dos fogos -let fireworks = []; -let particles = []; -// ... resto do código - -// Código principal -let targetDate = new Date(2025, 3, 10, 0, 0, 0).getTime(); -// ... resto do código \ No newline at end of file