(function () { var spawnPoint = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation()))); // constructor // constructor function TestFx() { var animationSettings = JSON.stringify({ fps: 30, frameIndex: 0, running: true, firstFrame: 0, lastFrame: 300, loop: true }); this.entity = Entities.addEntity({ type: "ParticleEffect", animationSettings: animationSettings, position: spawnPoint, dimensions: {x: 2, y: 2, z: 2}, emitVelocity: {x: 0.001, y: 0.001, z: 0}, emitRate: 20, particleRadius: 0.05, velocitySpread: {x: 0.005, y: 0.005, z: 0.003}, accelerationSpread: {x: 0.05, y: 0.02, z: 0.04}, emitAcceleration: {x: 0, y: 0.15, z: 0}, textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/spark.png", lifespan: 20.0, color: {red: 255, green: 255, blue: 255}, visible: true, locked: false }); this.isPlaying = true; } TestFx.prototype.Destroy = function () { Entities.editEntity(this.entity, { locked: false }); Entities.deleteEntity(this.entity); } var objs = []; function Init() { objs.push(new TestFx()); } function ShutDown() { var i, len = objs.length; for (i = 0; i < len; i++) { objs[i].Destroy(); } objs = []; } Init(); Script.scriptEnding.connect(ShutDown); })();