@tsparticles/plugin-canvas-mask
Version:
tsParticles canvas mask plugin
39 lines (38 loc) • 1.37 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", "./FontTextMask.js", "./TextMaskLine.js"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextMask = void 0;
const engine_1 = require("@tsparticles/engine");
const FontTextMask_js_1 = require("./FontTextMask.js");
const TextMaskLine_js_1 = require("./TextMaskLine.js");
class TextMask {
constructor() {
this.color = "#000000";
this.font = new FontTextMask_js_1.FontTextMask();
this.lines = new TextMaskLine_js_1.TextMaskLine();
this.text = "";
}
load(data) {
if ((0, engine_1.isNull)(data)) {
return;
}
if (data.color !== undefined) {
this.color = data.color;
}
this.font.load(data.font);
this.lines.load(data.lines);
if (data.text !== undefined) {
this.text = data.text;
}
}
}
exports.TextMask = TextMask;
});