UNPKG

2.79 kBJavaScriptView Raw
1(function (factory) {
2 if (typeof module === "object" && typeof module.exports === "object") {
3 var v = factory(require, exports);
4 if (v !== undefined) module.exports = v;
5 }
6 else if (typeof define === "function" && define.amd) {
7 define(["require", "exports", "tsparticles-engine"], factory);
8 }
9})(function (require, exports) {
10 "use strict";
11 Object.defineProperty(exports, "__esModule", { value: true });
12 exports.FireworkOptions = void 0;
13 const tsparticles_engine_1 = require("tsparticles-engine");
14 class FireworkOptions {
15 constructor() {
16 this.brightness = {
17 min: -30,
18 max: 30,
19 };
20 this.colors = ["#ff595e", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"];
21 this.gravity = 5;
22 this.minHeight = {
23 min: 10,
24 max: 30,
25 };
26 this.rate = 20;
27 this.saturation = {
28 min: -30,
29 max: 30,
30 };
31 this.sounds = true;
32 this.speed = { min: 5, max: 15 };
33 this.splitCount = {
34 min: 75,
35 max: 150,
36 };
37 }
38 load(data) {
39 if (!data) {
40 return;
41 }
42 if (data.colors !== undefined) {
43 if (data.colors instanceof Array) {
44 this.colors = [...data.colors];
45 }
46 else {
47 this.colors = data.colors;
48 }
49 }
50 if (data.brightness !== undefined) {
51 this.brightness = (0, tsparticles_engine_1.setRangeValue)(data.brightness);
52 }
53 if (data.gravity !== undefined) {
54 this.gravity = (0, tsparticles_engine_1.setRangeValue)(data.gravity);
55 }
56 if (data.minHeight !== undefined) {
57 this.minHeight = (0, tsparticles_engine_1.setRangeValue)(data.minHeight);
58 }
59 if (data.rate !== undefined) {
60 this.rate = (0, tsparticles_engine_1.setRangeValue)(data.rate);
61 }
62 if (data.saturation !== undefined) {
63 this.saturation = (0, tsparticles_engine_1.setRangeValue)(data.saturation);
64 }
65 if (data.sounds !== undefined) {
66 this.sounds = data.sounds;
67 }
68 if (data.speed !== undefined) {
69 this.speed = (0, tsparticles_engine_1.setRangeValue)(data.speed);
70 }
71 if (data.splitCount !== undefined) {
72 this.splitCount = (0, tsparticles_engine_1.setRangeValue)(data.splitCount);
73 }
74 }
75 }
76 exports.FireworkOptions = FireworkOptions;
77});