UNPKG

@tsparticles/plugin-canvas-mask

Version:

tsParticles canvas mask plugin

25 lines (24 loc) 659 B
import { isNull } from "@tsparticles/engine"; import { FontTextMask } from "./FontTextMask.js"; import { TextMaskLine } from "./TextMaskLine.js"; export class TextMask { constructor() { this.color = "#000000"; this.font = new FontTextMask(); this.lines = new TextMaskLine(); this.text = ""; } load(data) { if (isNull(data)) { return; } if (data.color !== undefined) { this.color = data.color; } this.font.load(data.font); this.lines.load(data.lines); if (data.text !== undefined) { this.text = data.text; } } }