UNPKG

tsparticles

Version:

Easily create highly customizable particle, confetti and fireworks 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.

38 lines (37 loc) 1.27 kB
import { Events } from "./Events/Events"; import { Modes } from "./Modes/Modes"; export class Interactivity { constructor() { this.detectsOn = "window"; this.events = new Events(); this.modes = new 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("slow") < 0) { this.events.onHover.mode.push("slow"); } } else if (this.events.onHover.mode !== "slow") { this.events.onHover.mode = [this.events.onHover.mode, "slow"]; } } } }