UNPKG

@tsparticles/plugin-polygon-mask

Version:

tsParticles polygon mask plugin

22 lines (21 loc) 707 B
import { OptionsColor, isNull, isString, loadProperty, stringToAlpha, } from "@tsparticles/engine"; export class PolygonMaskDrawStroke { color = new OptionsColor(); opacity = 1; width = 0.5; #pluginManager; constructor(pluginManager) { this.#pluginManager = pluginManager; } load(data) { if (isNull(data)) { return; } this.color = OptionsColor.create(this.color, data.color); if (isString(this.color.value)) { this.opacity = stringToAlpha(this.#pluginManager, this.color.value) ?? this.opacity; } loadProperty(this, "opacity", data.opacity); loadProperty(this, "width", data.width); } }