@tsparticles/editor
Version:
tsParticles Configuration Editor
77 lines (76 loc) • 2.52 kB
JavaScript
import { DestroyType, StartValueType } from "@tsparticles/engine";
import { EditorType } from "object-gui";
import { EditorBase } from "../../../../EditorBase";
export class SizeOptionsEditor extends 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", EditorType.select)
.change(() => {
void this.particles().refresh();
})
.addItems([
{
value: DestroyType.max,
},
{
value: DestroyType.min,
},
{
value: DestroyType.none,
},
]);
group.addProperty("enable", "Enable", EditorType.boolean).change(() => {
void this.particles().refresh();
});
group.addProperty("minimumValue", "Minimum Value", EditorType.number).change(() => {
void this.particles().refresh();
});
group.addProperty("speed", "Speed", EditorType.number).change(() => {
void this.particles().refresh();
});
group
.addProperty("startValue", "Start Value", EditorType.select)
.change(() => {
void this.particles().refresh();
})
.addItems([
{
value: StartValueType.max,
},
{
value: StartValueType.min,
},
{
value: StartValueType.random,
},
]);
group.addProperty("sync", "Sync", EditorType.boolean).change(() => {
void this.particles().refresh();
});
}
addProperties() {
this.group.addProperty("value", "Value", EditorType.number).change(() => {
void this.particles().refresh();
});
}
addRandom() {
const group = this.group.addGroup("random", "Random");
group.addProperty("enable", "Enable", EditorType.boolean).change(() => {
void this.particles().refresh();
});
group.addProperty("minimumValue", "Minimum Value", EditorType.number).change(() => {
void this.particles().refresh();
});
}
}