UNPKG

@tsparticles/editor

Version:

tsParticles Configuration Editor

29 lines (28 loc) 1.07 kB
import { EditorType } from "object-gui"; import { EditorBase } from "../../../../EditorBase"; export class BounceOptionsEditor extends EditorBase { constructor(particles) { super(particles); } addToGroup(parent) { this.group = parent.addGroup("bounce", "Bounce"); this.options = this.group.data; this.addFactors(); } addFactor(name, title) { const group = this.group.addGroup(name, title), randomGroup = group.addGroup("random", "Random"); randomGroup.addProperty("enable", "Enable", EditorType.boolean).change(() => { void this.particles().refresh(); }); randomGroup.addProperty("minimumValue", "Minimum Value", EditorType.number).change(() => { void this.particles().refresh(); }); group.addProperty("value", "Value", EditorType.number).change(() => { void this.particles().refresh(); }); } addFactors() { this.addFactor("horizontal", "Horizontal"); this.addFactor("vertical", "Vertical"); } }