@tsparticles/plugin-emitters-shape-canvas
Version:
tsParticles emitters shape canvas plugin
50 lines (49 loc) • 1.84 kB
JavaScript
(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", "./PixelsOptions.js", "./TextOptions.js"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmittersCanvasShapeOptions = void 0;
const engine_1 = require("@tsparticles/engine");
const PixelsOptions_js_1 = require("./PixelsOptions.js");
const TextOptions_js_1 = require("./TextOptions.js");
const minAlpha = 0;
class EmittersCanvasShapeOptions {
constructor() {
this.filter = (pixel) => pixel.a > minAlpha;
this.pixels = new PixelsOptions_js_1.PixelsOptions();
this.scale = 1;
this.selector = "";
this.text = new TextOptions_js_1.TextOptions();
}
load(data) {
if ((0, engine_1.isNull)(data)) {
return;
}
if (data.element !== undefined) {
this.element = data.element;
}
if (data.filter !== undefined) {
this.filter = data.filter;
}
this.pixels.load(data.pixels);
if (data.scale !== undefined) {
this.scale = data.scale;
}
if (data.selector !== undefined) {
this.selector = data.selector;
}
if (data.image !== undefined) {
this.image = data.image;
}
this.text.load(data.text);
}
}
exports.EmittersCanvasShapeOptions = EmittersCanvasShapeOptions;
});