UNPKG

@tsparticles/editor

Version:

tsParticles Configuration Editor

104 lines (103 loc) 3.9 kB
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports", "@tsparticles/engine", "object-gui", "../../../../EditorBase"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OpacityOptionsEditor = void 0; const engine_1 = require("@tsparticles/engine"); const object_gui_1 = require("object-gui"); const EditorBase_1 = require("../../../../EditorBase"); class OpacityOptionsEditor extends EditorBase_1.EditorBase { constructor(particles) { super(particles); } addToGroup(parent, options) { this.group = parent.addGroup("opacity", "Opacity", true, options); this.options = this.group.data; this.addAnimation(); this.addRandom(); this.addProperties(); } addAnimation() { const group = this.group.addGroup("animation", "Animation"); group .addProperty("destroy", "Destroy", object_gui_1.EditorType.select) .change(() => { void this.particles().refresh(); }) .addItems([ { value: engine_1.DestroyType.max, }, { value: engine_1.DestroyType.min, }, { value: engine_1.DestroyType.none, }, ]); group.addProperty("enable", "Enable", object_gui_1.EditorType.boolean).change(() => { void this.particles().refresh(); }); group .addProperty("minimumValue", "Minimum Value", object_gui_1.EditorType.number) .change(() => { void this.particles().refresh(); }) .min(0) .max(0) .step(0.01); group .addProperty("speed", "Speed", object_gui_1.EditorType.number) .change(() => { void this.particles().refresh(); }) .step(0.01); group .addProperty("startValue", "Start Value", object_gui_1.EditorType.select) .change(() => { void this.particles().refresh(); }) .addItems([ { value: engine_1.StartValueType.max, }, { value: engine_1.StartValueType.min, }, { value: engine_1.StartValueType.random, }, ]); group.addProperty("sync", "Sync", object_gui_1.EditorType.boolean).change(() => { void this.particles().refresh(); }); } addProperties() { this.group .addProperty("value", "Value", object_gui_1.EditorType.number) .change(() => { void this.particles().refresh(); }) .min(0) .max(1) .step(0.01); } addRandom() { const group = this.group.addGroup("random", "Random"); group.addProperty("enable", "Enable", object_gui_1.EditorType.boolean).change(() => { void this.particles().refresh(); }); group.addProperty("minimumValue", "Minimum Value", object_gui_1.EditorType.number).change(() => { void this.particles().refresh(); }); } } exports.OpacityOptionsEditor = OpacityOptionsEditor; });