tsparticles
Version:
Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.
29 lines (28 loc) • 834 B
JavaScript
import { OptionsColor } from "../../../../Options/Classes/OptionsColor";
import { stringToAlpha } from "../../../../Utils";
/**
* @category Polygon Mask Plugin
*/
export class PolygonMaskDrawStroke {
constructor() {
this.color = new OptionsColor();
this.width = 0.5;
this.opacity = 1;
}
load(data) {
var _a;
if (!data) {
return;
}
this.color = OptionsColor.create(this.color, data.color);
if (typeof this.color.value === "string") {
this.opacity = (_a = stringToAlpha(this.color.value)) !== null && _a !== void 0 ? _a : this.opacity;
}
if (data.opacity !== undefined) {
this.opacity = data.opacity;
}
if (data.width !== undefined) {
this.width = data.width;
}
}
}