/// /// HotfixEmoji.js /// An object that spawns code particles while grabbed /// Attach to an entity /// /// Author: Liv Erickson /// Copyright High Fidelity 2017 /// /// Licensed under the Apache 2.0 License /// See accompanying license file or http://apache.org/ /// (function () { var effect; HotfixEmoji = function () { _this = this; } HotfixEmoji.prototype = { preload: function (entityID) { _this.entityID = entityID; var codeProperties = { type: "ParticleEffect", position: Entities.getEntityProperties(_this.entityID).position, parentID: entityID, isEmitting: false, lifespan: 1, maxParticles: 1, textures: "https://hifi-content.s3.amazonaws.com/liv/Particles/CodeParticle.png", emitRate: 1, emitSpeed: 1, emitDimensions: { x: 0, y: 0, z: 0, w: 0 }, particleRadius: 0.15, radiusSpread: 0.15, radiusStart: 0.15, radiusFinish: 0.15, emitAcceleration: { x: 0, y: 0, z: 0 }, accelerationSpread: { x: 0, y: 0, z: 0 }, alpha: 1, alphaSpread: 0, alphaStart: 1, alphaFinish: 1, polarStart: 24, polarFinish: 168 }; effect = Entities.addEntity(codeProperties); var soundURL = "https://hifi-content.s3.amazonaws.com/liv/dev/emojis/91898__nbs-dark__digital.wav"; var sound = SoundCache.getSound(Script.resolvePath(soundURL)); var playback = { volume: 1, position: MyAvatar.position }; Script.setTimeout(Audio.playSound(sound, playback), 2000); }, unload: function () { Entities.deleteEntity(effect); }, startNearGrab: function () { Entities.editEntity(effect, { "isEmitting": true }) }, releaseGrab: function () { Entities.editEntity(effect, { "isEmitting": false }) } } return new HotfixEmoji(); })