UNPKG

tsparticles

Version:

Porting of the abandoned Vincent Garreau's particles.js, converted in TypeScript. Added many new cool features and various bug fixes.

32 lines (31 loc) 1.02 kB
import { Color } from "../Particles/Color"; import { ColorUtils } from "../../Utils/ColorUtils"; export class PolygonMaskDrawStroke { constructor() { this.color = new Color(); this.width = 0.5; this.opacity = 1; } load(data) { var _a; if (data !== undefined) { if (data.color !== undefined) { if (typeof data.color === "string") { this.color.value = data.color; } else { this.color.load(data.color); } if (typeof this.color.value === "string") { this.opacity = (_a = ColorUtils.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; } } } }