User prompt
make an launch trail object
User prompt
make a launch trail object that will spawn at the bottom of the screen and move to the location of the mouse click in 3 seconds
User prompt
spawn the fireworks 3 seconds after the mouse click
User prompt
keep one 3 fireworkobjects at the location of the mouseclick with minimal movement
User prompt
make the outer fireworks move faster
User prompt
make the firework a different color each time
User prompt
make it longer until the fireworks dissappear
Initial prompt
fireworks simulator
===================================================================
--- original.js
+++ change.js
@@ -12,10 +12,10 @@
self.alpha = 1;
self.scaleX = 1;
self.scaleY = 1;
self.update = function () {
- self.x += self.speedX;
- self.y += self.speedY;
+ self.x += self.speedX * 0.1;
+ self.y += self.speedY * 0.1;
self.alpha *= 0.98; // fade out more slowly
self.scaleX *= 0.99;
self.scaleY *= 0.99;
if (self.alpha < 0.05) {
@@ -29,9 +29,9 @@
self.particles = [];
self.explode = function (x, y) {
var colors = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF];
var randomColor = colors[Math.floor(Math.random() * colors.length)];
- for (var i = 0; i < 50; i++) {
+ for (var i = 0; i < 3; i++) {
var particle = new FireworkParticle();
var angle = Math.random() * Math.PI * 2;
var speed = Math.random() * 8 + 4;
particle.color = randomColor; // Assign random color to particle