@tsparticles/plugin-polygon-mask
Version:
tsParticles polygon mask plugin
39 lines (38 loc) • 1.42 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"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PolygonMaskDrawStroke = void 0;
const engine_1 = require("@tsparticles/engine");
class PolygonMaskDrawStroke {
constructor(engine) {
this._engine = engine;
this.color = new engine_1.OptionsColor();
this.width = 0.5;
this.opacity = 1;
}
load(data) {
if ((0, engine_1.isNull)(data)) {
return;
}
this.color = engine_1.OptionsColor.create(this.color, data.color);
if ((0, engine_1.isString)(this.color.value)) {
this.opacity = (0, engine_1.stringToAlpha)(this._engine, this.color.value) ?? this.opacity;
}
if (data.opacity !== undefined) {
this.opacity = data.opacity;
}
if (data.width !== undefined) {
this.width = data.width;
}
}
}
exports.PolygonMaskDrawStroke = PolygonMaskDrawStroke;
});