UNPKG

@tsparticles/editor

Version:

tsParticles Configuration Editor

50 lines (49 loc) 1.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BackgroundOptionsEditor = void 0; const object_gui_1 = require("object-gui"); const EditorBase_1 = require("../../../EditorBase"); class BackgroundOptionsEditor extends EditorBase_1.EditorBase { constructor(particles) { super(particles); } addToGroup(parent) { this.group = parent.addGroup("background", "Background"); this.options = this.group.data; this.addColor(); this.addProperties(); } addColor() { const options = this.options().color; this.group.addProperty("color", "Color", object_gui_1.EditorType.color, options.value, false).change((value) => { const options = this.options().color; if (typeof value === "string") { options.value = value; } this.notifyEditorChanged(); }); } addProperties() { this.group.addProperty("image", "Image", object_gui_1.EditorType.string).change(() => { void this.particles().refresh(); }); this.group .addProperty("opacity", "Opacity", object_gui_1.EditorType.number) .change(() => { void this.particles().refresh(); }) .step(0.01) .min(0) .max(1); this.group.addProperty("position", "Position", object_gui_1.EditorType.string).change(() => { void this.particles().refresh(); }); this.group.addProperty("repeat", "Repeat", object_gui_1.EditorType.string).change(() => { void this.particles().refresh(); }); this.group.addProperty("size", "Size", object_gui_1.EditorType.string).change(() => { void this.particles().refresh(); }); } } exports.BackgroundOptionsEditor = BackgroundOptionsEditor;