UNPKG

tsparticles-engine

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.

56 lines (55 loc) 1.59 kB
(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"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ParticlesDensity = void 0; class ParticlesDensity { constructor() { this.enable = false; this.width = 1920; this.height = 1080; } get area() { return this.width; } set area(value) { this.width = value; } get factor() { return this.height; } set factor(value) { this.height = value; } get value_area() { return this.area; } set value_area(value) { this.area = value; } load(data) { if (!data) { return; } if (data.enable !== undefined) { this.enable = data.enable; } const width = data.width ?? data.area ?? data.value_area; if (width !== undefined) { this.width = width; } const height = data.height ?? data.factor; if (height !== undefined) { this.height = height; } } } exports.ParticlesDensity = ParticlesDensity; });