UNPKG

tsparticles

Version:

Easily create highly customizable particle animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.

43 lines (42 loc) 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Interactivity = void 0; const Enums_1 = require("../../../Enums"); const Events_1 = require("./Events/Events"); const Modes_1 = require("./Modes/Modes"); class Interactivity { constructor() { this.detectsOn = Enums_1.InteractivityDetect.canvas; this.events = new Events_1.Events(); this.modes = new Modes_1.Modes(); } get detect_on() { return this.detectsOn; } set detect_on(value) { this.detectsOn = value; } load(data) { var _a, _b, _c; if (data === undefined) { return; } const detectsOn = (_a = data.detectsOn) !== null && _a !== void 0 ? _a : data.detect_on; if (detectsOn !== undefined) { this.detectsOn = detectsOn; } this.events.load(data.events); this.modes.load(data.modes); if (((_c = (_b = data.modes) === null || _b === void 0 ? void 0 : _b.slow) === null || _c === void 0 ? void 0 : _c.active) === true) { if (this.events.onHover.mode instanceof Array) { if (this.events.onHover.mode.indexOf(Enums_1.HoverMode.slow) < 0) { this.events.onHover.mode.push(Enums_1.HoverMode.slow); } } else if (this.events.onHover.mode !== Enums_1.HoverMode.slow) { this.events.onHover.mode = [this.events.onHover.mode, Enums_1.HoverMode.slow]; } } } } exports.Interactivity = Interactivity;