@tsparticles/editor
Version:
tsParticles Configuration Editor
52 lines (51 loc) • 2.05 kB
JavaScript
import { EditorType } from "object-gui";
import { EditorBase } from "../../../../EditorBase";
export class LifeOptionsEditor extends 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", EditorType.boolean).change(() => {
void this.particles().refresh();
});
randomGroup.addProperty("minimumValue", "MinimumValue", EditorType.number).change(() => {
void this.particles().refresh();
});
group.addProperty("sync", "Sync", EditorType.boolean).change(() => {
void this.particles().refresh();
});
group.addProperty("value", "Value", 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", EditorType.boolean).change(() => {
void this.particles().refresh();
});
randomGroup.addProperty("minimumValue", "MinimumValue", EditorType.number).change(() => {
void this.particles().refresh();
});
group.addProperty("sync", "Sync", EditorType.boolean).change(() => {
void this.particles().refresh();
});
group.addProperty("value", "Value", EditorType.number).change(() => {
void this.particles().refresh();
});
}
addProperties() {
this.group.addProperty("count", "Count", EditorType.number).change(() => {
void this.particles().refresh();
});
}
}