@tsparticles/editor
Version:
tsParticles Configuration Editor
53 lines (52 loc) • 1.76 kB
JavaScript
import { EditorType } from "object-gui";
import { EditorBase } from "../../../../EditorBase";
export class TiltOptionsEditor extends EditorBase {
constructor(particles) {
super(particles);
}
addToGroup(parent) {
this.group = parent.addGroup("tilt", "Tilt");
this.options = this.group.data;
this.addAnimation();
this.addProperties();
}
addAnimation() {
const group = this.group.addGroup("animation", "Animation");
group.addProperty("enable", "Enable", EditorType.boolean).change(() => {
void this.particles().refresh();
});
group.addProperty("speed", "Speed", EditorType.number).change(() => {
void this.particles().refresh();
});
group.addProperty("sync", "Sync", EditorType.boolean).change(() => {
void this.particles().refresh();
});
}
addProperties() {
this.group
.addProperty("direction", "Direction", EditorType.select)
.change(() => {
void this.particles().refresh();
})
.addItems([
{
value: "clockwise",
},
{
value: "counterClockwise",
},
{
value: "random",
},
]);
this.group.addProperty("enable", "Enable", EditorType.boolean).change(() => {
void this.particles().refresh();
});
this.group.addProperty("random", "Random", EditorType.boolean).change(() => {
void this.particles().refresh();
});
this.group.addProperty("value", "Value", EditorType.number).change(() => {
void this.particles().refresh();
});
}
}