@tsparticles/editor
Version:
tsParticles Configuration Editor
66 lines (65 loc) • 2.95 kB
JavaScript
(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.LifeOptionsEditor = void 0;
const object_gui_1 = require("object-gui");
const EditorBase_1 = require("../../../../EditorBase");
class LifeOptionsEditor extends EditorBase_1.EditorBase {
constructor(particles) {
super(particles);
}
addToGroup(parent, options) {
this.group = parent.addGroup("life", "Life", true, options);
this.options = this.group.data;
this.addDelay();
this.addDuration();
this.addProperties();
}
addDelay() {
const group = this.group.addGroup("delay", "Delay");
const randomGroup = group.addGroup("random", "Random");
randomGroup.addProperty("enable", "Enable", object_gui_1.EditorType.boolean).change(() => {
void this.particles().refresh();
});
randomGroup.addProperty("minimumValue", "MinimumValue", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
group.addProperty("sync", "Sync", object_gui_1.EditorType.boolean).change(() => {
void this.particles().refresh();
});
group.addProperty("value", "Value", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
}
addDuration() {
const group = this.group.addGroup("duration", "Duration");
const randomGroup = group.addGroup("random", "Random");
randomGroup.addProperty("enable", "Enable", object_gui_1.EditorType.boolean).change(() => {
void this.particles().refresh();
});
randomGroup.addProperty("minimumValue", "MinimumValue", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
group.addProperty("sync", "Sync", object_gui_1.EditorType.boolean).change(() => {
void this.particles().refresh();
});
group.addProperty("value", "Value", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
}
addProperties() {
this.group.addProperty("count", "Count", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
}
}
exports.LifeOptionsEditor = LifeOptionsEditor;
});