@tsparticles/plugin-emitters-shape-canvas
Version:
tsParticles emitters shape canvas plugin
40 lines (39 loc) • 1.28 kB
JavaScript
;
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;