UNPKG

@tsparticles/editor

Version:

tsParticles Configuration Editor

54 lines (53 loc) 1.86 kB
import { RotateDirection } from "@tsparticles/engine"; import { EditorType } from "object-gui"; import { EditorBase } from "../../../../EditorBase"; export class RotateOptionsEditor extends EditorBase { constructor(particles) { super(particles); } addToGroup(parent) { this.group = parent.addGroup("rotate", "Rotate"); 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: RotateDirection.clockwise, }, { value: RotateDirection.counterClockwise, }, { value: RotateDirection.random, }, ]); this.group.addProperty("path", "Path", 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(); }); } }