UNPKG

@tsparticles/plugin-polygon-mask

Version:

tsParticles polygon mask plugin

25 lines (24 loc) 750 B
import { OptionsColor, isNull, isString, stringToAlpha, } from "@tsparticles/engine"; export class PolygonMaskDrawStroke { constructor(engine) { this._engine = engine; this.color = new OptionsColor(); this.width = 0.5; this.opacity = 1; } load(data) { if (isNull(data)) { return; } this.color = OptionsColor.create(this.color, data.color); if (isString(this.color.value)) { this.opacity = stringToAlpha(this._engine, this.color.value) ?? this.opacity; } if (data.opacity !== undefined) { this.opacity = data.opacity; } if (data.width !== undefined) { this.width = data.width; } } }