/* eslint-disable indent */ // DEPENDENCIES // //////////////////////////////////////////////////////////////////////// var // SEQUENCER = Script.require( // "https://hifi-content.s3.amazonaws.com/milad/ROLC/Organize/O_Projects/Hifi/Scripts/hifi-content/Prototyping/Particle-Sequencer/Particle_Sequencer.js?" + Date.now()) SEQUENCER = Script.require("./Particle_Sequencer.js?" + Date.now()) // SETUPS AND CONSTS // //////////////////////////////////////////////////////////////////////// // ENTITY CONSTS // //////////////////////////////////////////////////////////////////////// var // General // //////////////////////////////////////////////////////////////// POSITION = "position", ROTATION = "rotation", // HOOKS // //////////////////////////////////////////////////////////// CLICK_DOWN = "clickDownOnEntity", CLICK_RELEASE = "clickReleaseOnEntity", CLICK_HOLD = "holdingClickOnEntity", MOUSE_MOVE = "mouseMoveOnEntity", MOUSE_PRESS = "mousePressOnEntity", MOUSE_RELEASE = "mouseReleaseOnEntity", MOUSE_DOUBLE_PRESS_OFF = "mouseDoublePressOffEntity", HOVER_ENTER = "hoverEnterEntity", HOVER_LEAVE = "hoverLeaveEntity", HOVER_OVER = "hoverOverEntity", WEB_EVENT = "webEventReceived", LEAVE = "leaveEntity", ENTER = "enterEntity", COLLISION = "collisionWithEntity", START_TRIGGER = "startTrigger", STOP_TRIGGER = "stopTrigger", START_FAR_TRIGGER = "startFarTrigger", CONTINUE_FAR_TRIGGER = "continueFarTrigger", STOP_FAR_TRIGGER = "stopFarTrigger", START_NEAR_TRIGGER = "startNearTrigger", CONTINUE_NEAR_TRIGGER = "continueNearTrigger", STOP_NEAR_TRIGGER = "stopNearTrigger", START_DISTANCE_GRAB = "startDistanceGrab", CONTINUE_DISTANCE_GRAB = "continueDistanceGrab", START_NEAR_GRAB = "startNearGrab", CONTINUE_NEAR_GRAB = "continueNearGrab", RELEASE_GRAB = "releaseGrab", START_EQUIP = "startEquip", CONTINUE_EQUIP = "continueEquip", RELEASE_EQUIP = "releaseEquip", // Particles // //////////////////////////////////////////////////////////////// LIFESPAN = "lifespan", MAX_PARTICLES = "maxParticles", TEXTURES = "textures", SPEED_SPREAD = "speedSpread", IS_EMITTING = "isEmitting", EMIT_RADIUS_START = "emitRadiusStart", EMIT_RATE = "emitRate", EMIT_SPEED = "emitSpeed", EMIT_DIMENSIONS = "emitDimensions", EMIT_ORIENTATION = "emitOrientation", EMIT_ACCELERATION = "emitAcceleration", EMITTER_SHOULD_TRAIL = "emitterShouldTrail", PARTICLE_RADIUS = "particleRadius", SPIN_SPREAD = "spinSpread", SPIN_START = "spinStart", SPIN_FINISH = "spinFinish", ROTATE_WITH_ENTITY = "rotateWithEntity", PARTICLE_SPIN = "particleSpin", RADIUS_SPREAD = "radiusSpread", RADIUS_START = "radiusStart", RADIUS_FINISH = "radiusFinish", COLOR = "color", COLOR_SPREAD = "colorSpread", COLOR_START = "colorStart", COLOR_FINISH = "colorFinish", ACCELERATION_SPREAD = "accelerationSpread", ALPHA = "alpha", ALPHA_SPREAD = "alphaSpread", ALPHA_START = "alphaStart", ALPHA_FINISH = "alphaFinish", POLOR_START = "polarStart", POLOR_FINISH = "polarFinish", AZIMUTH_START = "azimuthStart", AZIMUTH_FINISH = "azimuthFinish", // MIN AND MAX // //////////////////////////////////////////////////////////////// MINIMUM_MAX_PARTICLES = 1, MAXIMUM_MAX_PARTICLES = 100000, MINIMUM_LIFESPAN = 0.0, MAXIMUM_LIFESPAN = 86400.0, // 1 day MINIMUM_EMIT_RATE = 0.0, MAXIMUM_EMIT_RATE = 100000.0, MINIMUM_EMIT_SPEED = -1000.0, MAXIMUM_EMIT_SPEED = 1000.0, // Approx mach 3 MINIMUM_EMIT_DIMENSION = 0.0, MAXIMUM_EMIT_DIMENSION = 32768, MINIMUM_EMIT_RADIUS_START = 0.0, MAXIMUM_EMIT_RADIUS_START = 1.0, MINIMUM_EMIT_ACCELERATION = -100.0, // ~ 10g MAXIMUM_EMIT_ACCELERATION = 100.0, MINIMUM_ACCELERATION_SPREAD = 0.0, MAXIMUM_ACCELERATION_SPREAD = 100.0, MINIMUM_PARTICLE_RADIUS = 0.0, MAXIMUM_PARTICLE_RADIUS = 32768, MINIMUM_PARTICLE_SPIN = -2.0 * Math.PI, MAXIMUM_PARTICLE_SPIN = 2.0 * Math.PI ; // PARTICLE SEQUENCER CONSTS // //////////////////////////////////////////////////////////////////////// var LOOP = "loop", START = "start", END = "end", TO = "to", AT = "at", ; // USER FILL OUT BELOW // //////////////////////////////////////////////////////////////////////// // TEXTURES // //////////////////////////////////////////////////////////////////////// // Add your textures here var textures = { atmosphere: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/atmosphere-particle-2.png", bokeh: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/Bokeh-Particle-2.png", cloud: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/cloud-sprite.png", fireball: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/Fireball.jpg", heart: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/heart-2.png", spark: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/Particle-Spark.png", plasma: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/plasma-sprite.png", dust: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/playaDust.png", rainbow: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/rainbow.png", mist: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/mist-sprite.png", star: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/Star-sprite.png", water: "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/water-bubble.png", triangle: "https://hifi-content.s3.amazonaws.com/alan/dev/Particle-Triangle.png" } // PARTICLES // //////////////////////////////////////////////////////////////////////// // Add your particles here var sequencedEntities = { "FUSE": { "dimensions": { "x": 12.41027545928955, "y": 12.41027545928955, "z": 12.41027545928955 }, "rotation": { "x": 0.6104676723480225, "y": -0.12175172567367554, "z": -0.15297168493270874, "w": 0.7675135135650635 }, "alpha": 0.5, "textures": "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/plasma-sprite.png", "maxParticles": 500, "lifespan": 1, "emitRate": 0, "emitSpeed": 4, "speedSpread": 0.10000000149011612, "emitOrientation": { "x": -0.0000152587890625, "y": -0.0000152587890625, "z": -0.0000152587890625, "w": 1 }, "emitDimensions": { "x": 0.009999999776482582, "y": 0.009999999776482582, "z": 0.009999999776482582 }, "emitRadiusStart": 0, "polarStart": 2.356194496154785, "polarFinish": 3.1415927410125732, "azimuthStart": 2.356194496154785, "emitAcceleration": { "x": 0, "y": -10, "z": 0 }, "particleRadius": 0.029999999329447746, "radiusSpread": 0.10000000149011612, "radiusStart": 0.05000000074505806, "radiusFinish": 0, "colorStart": { "red": null, "green": null, "blue": null }, "colorFinish": { "red": null, "green": null, "blue": null }, "alphaStart": 1, "alphaFinish": 0, "emitterShouldTrail": true, "spinStart": null, "spinFinish": null }, "DETONATE": { "dimensions": { "x": 4, "y": 4, "z": 4 }, "rotation": { "x": -0.0000152587890625, "y": -0.0000152587890625, "z": -0.0000152587890625, "w": 1 }, "color": { "red": 161, "green": 94, "blue": 0 }, "alpha": 0, "textures": "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/atmosphere-particle-2.png", "maxParticles": 100, "lifespan": 0.10000000149011612, "emitRate": 0, "emitSpeed": 0, "speedSpread": 0, "emitOrientation": { "x": -0.0000152587890625, "y": -0.0000152587890625, "z": -0.0000152587890625, "w": 1 }, "polarFinish": 3.1415927410125732, "emitAcceleration": { "x": 0, "y": 0, "z": 0 }, "particleRadius": 1.5, "radiusStart": 1, "radiusFinish": 2, "colorStart": { "red": 255, "green": 213, "blue": 128 }, "colorFinish": { "red": 255, "green": 0, "blue": 0 }, "alphaStart": 1, "alphaFinish": 1, "emitterShouldTrail": true, "spinStart": null, "spinFinish": null }, "SHOCKWAVE": { "dimensions": { "x": 11.700000762939453, "y": 11.700000762939453, "z": 11.700000762939453 }, "rotation": { "x": -0.0000457763671875, "y": -0.1299915909767151, "z": 0.0000152587890625, "w": 0.9914854764938354 }, "color": { "red": 120, "green": 120, "blue": 120 }, "alpha": 0.5, "textures": "https://content.highfidelity.com/DomainContent/production/Particles/wispy-smoke.png", "maxParticles": 500, "lifespan": 0.5, "emitRate": 0, "emitSpeed": 2, "emitOrientation": { "x": -0.0000152587890625, "y": -0.0000152587890625, "z": -0.0000152587890625, "w": 1 }, "emitDimensions": { "x": 4, "y": 0, "z": 4 }, "polarFinish": 3.1415927410125732, "azimuthStart": 0, "emitAcceleration": { "x": 0, "y": 1, "z": 0 }, "accelerationSpread": { "x": 0, "y": 1, "z": 0 }, "particleRadius": 1, "radiusSpread": 0.20000000298023224, "radiusStart": 2, "radiusFinish": null, "colorStart": { "red": 120, "green": 120, "blue": 120 }, "colorFinish": { "red": null, "green": null, "blue": null }, "alphaSpread": 1, "alphaStart": 0.5, "alphaFinish": 0, "emitterShouldTrail": true, "spinStart": null, "spinFinish": 0 }, "CHIMNEY": { "dimensions": { "x": 10.950000762939453, "y": 10.950000762939453, "z": 10.950000762939453 }, "rotation": { "x": -0.0000152587890625, "y": -0.0000152587890625, "z": -0.0000152587890625, "w": 1 }, "color": { "red": 168, "green": 168, "blue": 168 }, "alpha": 0.5, "textures": "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/cloud-sprite.png", "maxParticles": 200, "lifespan": 1.5, "emitRate": 0, "emitSpeed": 1, "speedSpread": 0, "emitOrientation": { "x": -0.0000152587890625, "y": -0.0000152587890625, "z": -0.0000152587890625, "w": 1 }, "emitDimensions": { "x": 0, "y": 1, "z": 0 }, "polarFinish": 3.1415927410125732, "azimuthStart": 0, "emitAcceleration": { "x": 0, "y": 1, "z": 0 }, "particleRadius": 0.5, "radiusStart": 1, "radiusFinish": 3, "colorStart": { "red": 143, "green": 143, "blue": 143 }, "colorFinish": { "red": 161, "green": 161, "blue": 161 }, "alphaStart": 1, "alphaFinish": 0.25, "emitterShouldTrail": true, "spinStart": null, "spinFinish": null }, "PLUME": { "dimensions": { "x": 11, "y": 11, "z": 11 }, "rotation": { "x": -0.0000152587890625, "y": -0.0000152587890625, "z": -0.0000152587890625, "w": 1 }, "color": { "red": 120, "green": 120, "blue": 120 }, "alpha": 0, "textures": "https://hifi-content.s3.amazonaws.com/alan/dev/Particles/cloud-sprite.png", "maxParticles": 25, "emitRate": 0, "emitSpeed": 0, "speedSpread": 0, "emitOrientation": { "x": -0.0000152587890625, "y": -0.0000152587890625, "z": -0.0000152587890625, "w": 1 }, "emitDimensions": { "x": 3, "y": 0, "z": 3 }, "polarFinish": 3.1415927410125732, "azimuthStart": 0, "emitAcceleration": { "x": 0, "y": 0, "z": 0 }, "particleRadius": 4, "radiusStart": 4, "radiusFinish": 2, "colorStart": { "red": 115, "green": 115, "blue": 115 }, "colorFinish": { "red": 0, "green": 0, "blue": 0 }, "alphaStart": 1, "alphaFinish": 1, "emitterShouldTrail": true, "spinStart": null, "spinFinish": 6.2831854820251465 }, "ASHES": { "dimensions": { "x": 31.825002670288086, "y": 31.825002670288086, "z": 31.825002670288086 }, "rotation": { "x": -0.0000457763671875, "y": -0.1304493546485901, "z": 0.0000152587890625, "w": 0.9914549589157104 }, "color": { "red": 120, "green": 120, "blue": 120 }, "alpha": 0.5, "textures": "https://content.highfidelity.com/DomainContent/production/Particles/wispy-smoke.png", "maxParticles": 100, "lifespan": 2, "emitRate": 0, "emitSpeed": 0, "speedSpread": 0, "emitOrientation": { "x": -0.0000152587890625, "y": -0.0000152587890625, "z": -0.0000152587890625, "w": 1 }, "polarFinish": 3.1415927410125732, "azimuthStart": 0, "emitAcceleration": { "x": 0, "y": 2.5, "z": 0 }, "accelerationSpread": { "x": 0.25, "y": 0, "z": 0.25 }, "particleRadius": 0.5, "radiusSpread": 0.30000001192092896, "radiusStart": 0, "radiusFinish": 2, "colorStart": { "red": 120, "green": 120, "blue": 120 }, "colorFinish": { "red": null, "green": null, "blue": null }, "alphaSpread": 1, "alphaStart": 1, "alphaFinish": 0, "emitterShouldTrail": true, "spinStart": null, "spinFinish": 0 } }; // SEQUENCE // //////////////////////////////////////////////////////////////////////// // Add your sequence below var sequence = { "FUSE": [ [ "START explode", // AT 0000, "CHANGE EMIT_RATE to 250 at 5", // AT 500 // AT 1000 // AT 1500 // AT 2000 // AT 2500 // AT 3000 "CHANGE EMIT_RATE to 0 at 3000", //"CHANGE loop TO 0 AT 7000", "END" ] ], "DETONATE": [ [ "START explode", // AT 0000 "CHANGE EMIT_RATE to 0 at 5", // AT 500 // AT 1000 // AT 1500 // AT 2000 // AT 2500 // AT 3000 "CHANGE EMIT_RATE to 1000 at 3000", "CHANGE PARTICLE_RADIUS to 3 at 3125", "CHANGE PARTICLE_RADIUS to 8 at 3250", "CHANGE PARTICLE_RADIUS to 3 at 3375", "CHANGE EMIT_RATE to 0 at 3500", //"CHANGE loop TO 0 AT 7000", "END" ] ], "SHOCKWAVE": [ [ "START explode", // AT 0000 "CHANGE EMIT_RATE to 0 at 5", // AT 500 // AT 1000 // AT 1500 // AT 2000 // AT 2500 // AT 3000 "CHANGE EMIT_DIMENSIONS to 0,0,0 at 3000", "CHANGE EMIT_RATE to 500 AT 3250", "CHANGE EMIT_DIMENSIONS to 4,0,4 at 3250", // AT 3500 "CHANGE EMIT_DIMENSIONS to 5,0,5 at 3500", "CHANGE EMIT_DIMENSIONS to 8,0,8 at 3750", "CHANGE EMIT_RATE to 0 AT 4500", //"CHANGE loop TO 0 AT 7000", "END" ] ], "CHIMNEY": [ [ "START explode", // AT 0000 "CHANGE EMIT_RATE to 0 at 5", // AT 500 // AT 1000 // AT 1500 // AT 2000 // AT 2500 // AT 3000 // AT 3500 "CHANGE EMIT_RATE to 100 AT 3000", // AT 4000 "CHANGE EMIT_RATE to 50 AT 3500", // AT 4500 "CHANGE EMIT_RATE to 25 AT 4505", //"CHANGE loop TO 0 AT 7000", "CHANGE EMIT_RATE to 0 AT 5000", // AT 5000 "END" ] ], "PLUME": [ [ "START explode", // AT 0000 "CHANGE EMIT_RATE to 0 at 5", // AT 500 // AT 1000 // AT 1500 // AT 2000 // AT 2500 // AT 3000 // AT 3500 // AT 4000 "CHANGE PARTICLE_RADIUS to 2 at 3500", "CHANGE EMIT_RATE to 25 AT 4000", // AT 4500 "CHANGE PARTICLE_RADIUS to 4 at 4500", // AT 5000 "CHANGE EMIT_RATE to 0 AT 5005", //"CHANGE loop TO 0 AT 7000", "END" ] ], "ASHES": [ [ "START explode", // AT 0000 "CHANGE EMIT_RATE to 55 at 5", // AT 500 // AT 1000 // AT 1500 // AT 2000 // AT 2500 // AT 3000 // AT 3500 // AT 4000 // AT 4500 "CHANGE EMIT_RATE to 55 at 4500", // AT 5000 "END" ] ] }; // REGISTER HOOKS HERE! // //////////////////////////////////////////////////////////// var hooks = { "explode": { start: [MOUSE_PRESS], stop: [MOUSE_PRESS] } }; module.exports = { sequencedEntities: sequencedEntities, hooks: hooks, sequence: sequence, textures: textures }; /* // [ // "START ohno", // "CHANGE color TO 0,255,0 AT 500", // "CHANGE color_start TO 0,255,0 AT 500", // "CHANGE position TO 0,0.5,0 AT 750", // "CHANGE loop TO 0 AT 1500", // "END" // ] ] // "SMOKE": [ // [ // "START explode", // "CHANGE color TO 255,255,0 AT 500", // "CHANGE color_start TO 255,255,0 AT 500", // "CHANGE position TO 0,2,0 AT 1000", // "CHANGE loop TO 0 AT 1500", // "END" // ], // [ // "START ohno", // "CHANGE color TO 255,255,0 AT 500", // "CHANGE color_start TO 255,255,0 AT 500", // "CHANGE position TO 0,0.5,0 AT 750", // "CHANGE loop TO 0 AT 1500", // "END" // ] // ] */