From 0a6a35ddd807ad7aae19cffa33ae9e04347348d2 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 24 Feb 2016 16:30:29 -0800 Subject: [PATCH] need multiple explosions at once --- examples/libraries/utils.js | 2 +- .../fireworksLaunchButtonEntityScript.js | 44 +++++-------------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/examples/libraries/utils.js b/examples/libraries/utils.js index b2b2902cb0..f4a431a657 100644 --- a/examples/libraries/utils.js +++ b/examples/libraries/utils.js @@ -199,7 +199,7 @@ pointInExtents = function(point, minPoint, maxPoint) { * @param Number l The lightness * @return Array The RGB representation */ -hslToRgb = function(hsl, hueOffset) { +hslToRgb = function(hsl) { var r, g, b; if (hsl.s == 0) { r = g = b = hsl.l; // achromatic diff --git a/examples/playa/fireworks/fireworksLaunchButtonEntityScript.js b/examples/playa/fireworks/fireworksLaunchButtonEntityScript.js index cfb81674cb..2abf96a86d 100644 --- a/examples/playa/fireworks/fireworksLaunchButtonEntityScript.js +++ b/examples/playa/fireworks/fireworksLaunchButtonEntityScript.js @@ -21,12 +21,12 @@ min: 2000, max: 3000 }; + _this.explodeTime = 500; }; Fireworks.prototype = { startNearTrigger: function() { - print("EBL NEAR TRIGGER") _this.shootFirework(); }, @@ -170,25 +170,18 @@ name: "fireworks emitter", position: explodePosition, type: "ParticleEffect", - color: { - red: 205, - green: 84, - blue: 84 - }, - maxParticles: 1000, + colorStart: hslToRgb({h: Math.random(), s: 0.5, l: 0.7}), + color: hslToRgb({h: Math.random(), s: 0.5, l: 0.5}), + colorFinish: hslToRgb({h: Math.random(), s: 0.5, l: 0.7}), + maxParticles: 10000, lifetime: 20, - lifespan: 4, - emitRate: 1000, - emitSpeed: 1.5, + lifespan: randFloat(1.5, 3), + emitRate: randInt(500, 3000), + emitSpeed: randFloat(0.5, 2), speedSpread: 1.0, - emitOrientation: { - x: -0.2, - y: 0, - z: 0, - w: 0.7 - }, + emitOrientation: Quat.fromPitchYawRollDegrees(randInt(0, 360), randInt(0, 360), randInt(0, 360)), polarStart: 1, - polarFinish: 1.2, + polarFinish: randFloat(1.2, 3), azimuthStart: -Math.PI, azimuthFinish: Math.PI, emitAcceleration: { @@ -205,21 +198,6 @@ radiusSpread: 0, radiusStart: 0.06, radiusFinish: 0.05, - colorSpread: { - red: 0, - green: 0, - blue: 0 - }, - colorStart: { - red: 255, - green: 255, - blue: 255 - }, - colorFinish: { - red: 255, - green: 255, - blue: 255 - }, alpha: 1, alphaSpread: 0, alphaStart: 0, @@ -233,7 +211,7 @@ Entities.editEntity(_this.firework, { isEmitting: false }); - }, 1000) + }, _this.explodeTime); },