UNPKG

@tsparticles/editor

Version:

tsParticles Configuration Editor

72 lines (71 loc) 3.08 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", "object-gui", "../../../../EditorBase"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DestroyOptionsEditor = void 0; const object_gui_1 = require("object-gui"); const EditorBase_1 = require("../../../../EditorBase"); class DestroyOptionsEditor extends EditorBase_1.EditorBase { constructor(particles) { super(particles); } addToGroup(parent) { this.group = parent.addGroup("destroy", "Destroy"); this.options = this.group.data; this.addSplit(); this.addProperties(); } addProperties() { const group = this.group; group .addProperty("mode", "Mode", object_gui_1.EditorType.select) .change(() => { void this.particles().refresh(); }) .addItems([ { value: "none", }, { value: "split", }, ]); } addSplit() { const group = this.group.addGroup("split", "Split"); const factorGroup = group.addGroup("factor", "Factor"); const randomFactorGroup = factorGroup.addGroup("random", "Random"); randomFactorGroup.addProperty("enable", "Enable", object_gui_1.EditorType.boolean).change(() => { void this.particles().refresh(); }); randomFactorGroup.addProperty("minimumValue", "Minimum Value", object_gui_1.EditorType.number).change(() => { void this.particles().refresh(); }); factorGroup.addProperty("value", "Value", object_gui_1.EditorType.number).change(() => { void this.particles().refresh(); }); const rateGroup = group.addGroup("rate", "Rate"); const randomRateGroup = rateGroup.addGroup("random", "Random"); randomRateGroup.addProperty("enable", "Enable", object_gui_1.EditorType.boolean).change(() => { void this.particles().refresh(); }); randomRateGroup.addProperty("minimumValue", "Minimum Value", object_gui_1.EditorType.number).change(() => { void this.particles().refresh(); }); rateGroup.addProperty("value", "Value", object_gui_1.EditorType.number).change(() => { void this.particles().refresh(); }); group.addProperty("count", "Count", object_gui_1.EditorType.number).change(() => { void this.particles().refresh(); }); } } exports.DestroyOptionsEditor = DestroyOptionsEditor; });