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.

67 lines (66 loc) 2.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PolygonMask = void 0; const Enums_1 = require("../../Enums"); const Draw_1 = require("./Draw"); const Move_1 = require("./Move"); const Inline_1 = require("./Inline"); const LocalSvg_1 = require("./LocalSvg"); const Utils_1 = require("../../../../Utils"); class PolygonMask { constructor() { this.draw = new Draw_1.Draw(); this.enable = false; this.inline = new Inline_1.Inline(); this.move = new Move_1.Move(); this.scale = 1; this.type = Enums_1.Type.none; } get inlineArrangement() { return this.inline.arrangement; } set inlineArrangement(value) { this.inline.arrangement = value; } load(data) { var _a; if (data !== undefined) { this.draw.load(data.draw); const inline = (_a = data.inline) !== null && _a !== void 0 ? _a : { arrangement: data.inlineArrangement, }; if (inline !== undefined) { this.inline.load(inline); } this.move.load(data.move); if (data.scale !== undefined) { this.scale = data.scale; } if (data.type !== undefined) { this.type = data.type; } if (data.enable !== undefined) { this.enable = data.enable; } else { this.enable = this.type !== Enums_1.Type.none; } if (data.url !== undefined) { this.url = data.url; } if (data.data !== undefined) { if (typeof data.data === "string") { this.data = data.data; } else { this.data = new LocalSvg_1.LocalSvg(); this.data.load(data.data); } } if (data.position !== undefined) { this.position = Utils_1.Utils.deepExtend({}, data.position); } } } } exports.PolygonMask = PolygonMask;