UNPKG

tsparticles-fireworks

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.

78 lines (77 loc) 2.8 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", "tsparticles-engine"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FireworkOptions = void 0; const tsparticles_engine_1 = require("tsparticles-engine"); class FireworkOptions { constructor() { this.brightness = { min: -30, max: 30, }; this.colors = ["#ff595e", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"]; this.gravity = 5; this.minHeight = { min: 10, max: 30, }; this.rate = 20; this.saturation = { min: -30, max: 30, }; this.sounds = true; this.speed = { min: 5, max: 15 }; this.splitCount = { min: 75, max: 150, }; } load(data) { if (!data) { return; } if (data.colors !== undefined) { if ((0, tsparticles_engine_1.isArray)(data.colors)) { this.colors = [...data.colors]; } else { this.colors = data.colors; } } if (data.brightness !== undefined) { this.brightness = (0, tsparticles_engine_1.setRangeValue)(data.brightness); } if (data.gravity !== undefined) { this.gravity = (0, tsparticles_engine_1.setRangeValue)(data.gravity); } if (data.minHeight !== undefined) { this.minHeight = (0, tsparticles_engine_1.setRangeValue)(data.minHeight); } if (data.rate !== undefined) { this.rate = (0, tsparticles_engine_1.setRangeValue)(data.rate); } if (data.saturation !== undefined) { this.saturation = (0, tsparticles_engine_1.setRangeValue)(data.saturation); } if (data.sounds !== undefined) { this.sounds = data.sounds; } if (data.speed !== undefined) { this.speed = (0, tsparticles_engine_1.setRangeValue)(data.speed); } if (data.splitCount !== undefined) { this.splitCount = (0, tsparticles_engine_1.setRangeValue)(data.splitCount); } } } exports.FireworkOptions = FireworkOptions; });