@tsparticles/editor
Version:
tsParticles Configuration Editor
76 lines (75 loc) • 2.69 kB
JavaScript
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "object-gui", "../../../../EditorBase"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HoverEventsOptionsEditor = void 0;
const object_gui_1 = require("object-gui");
const EditorBase_1 = require("../../../../EditorBase");
class HoverEventsOptionsEditor extends EditorBase_1.EditorBase {
constructor(particles) {
super(particles);
}
addToGroup(parent) {
this.group = parent.addGroup("onHover", "Hover Events");
this.options = this.group.data;
this.addParallax();
this.addProperties();
}
addParallax() {
const parallax = this.group.addGroup("parallax", "Parallax");
parallax.addProperty("enable", "Enable", object_gui_1.EditorType.boolean).change(() => {
void this.particles().refresh();
});
parallax.addProperty("force", "Force", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
parallax.addProperty("smooth", "Smooth", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
}
addProperties() {
this.group.addProperty("enable", "Enable", object_gui_1.EditorType.boolean).change(() => {
void this.particles().refresh();
});
this.group
.addProperty("mode", "Mode", object_gui_1.EditorType.select)
.change(() => {
void this.particles().refresh();
})
.addItems([
{
value: "attract",
},
{
value: "bubble",
},
{
value: "connect",
},
{
value: "grab",
},
{
value: "light",
},
{
value: "repulse",
},
{
value: "slow",
},
{
value: "trail",
},
]);
}
}
exports.HoverEventsOptionsEditor = HoverEventsOptionsEditor;
});