@tsparticles/editor
Version:
tsParticles Configuration Editor
91 lines (90 loc) • 3.57 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", "@tsparticles/engine", "object-gui", "../../../../EditorBase"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SizeOptionsEditor = void 0;
const engine_1 = require("@tsparticles/engine");
const object_gui_1 = require("object-gui");
const EditorBase_1 = require("../../../../EditorBase");
class SizeOptionsEditor extends EditorBase_1.EditorBase {
constructor(particles) {
super(particles);
}
addToGroup(parent) {
this.group = parent.addGroup("size", "Size");
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();
});
group.addProperty("speed", "Speed", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
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();
});
}
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.SizeOptionsEditor = SizeOptionsEditor;
});