UNPKG

@tsparticles/plugin-polygon-mask

Version:

tsParticles polygon mask plugin

36 lines (35 loc) 1.51 kB
import { type Engine, type IContainerPlugin, type ICoordinates, type IDelta, type IDimension, OutModeDirection, type Particle } from "@tsparticles/engine"; import type { ISvgPath } from "./Interfaces/ISvgPath.js"; import type { PolygonMaskContainer } from "./types.js"; export declare class PolygonMaskInstance implements IContainerPlugin { dimension: IDimension; offset?: ICoordinates; paths?: ISvgPath[]; raw?: ICoordinates[]; redrawTimeout?: number | NodeJS.Timeout; private readonly _container; private readonly _engine; private _moveRadius; private _scale; constructor(container: PolygonMaskContainer, engine: Engine); clickPositionValid(position: ICoordinates): boolean; draw(context: CanvasRenderingContext2D): void; init(): Promise<void>; particleBounce(particle: Particle, delta: IDelta, direction: OutModeDirection): boolean; particlePosition(position?: ICoordinates): ICoordinates | undefined; particlesInitialization(): boolean; resize(): void; stop(): void; private readonly _checkInsidePolygon; private readonly _createPath2D; private readonly _downloadSvgPath; private readonly _drawPoints; private readonly _getEquidistantPointByIndex; private readonly _getPointByIndex; private readonly _getRandomPoint; private readonly _getRandomPointByLength; private readonly _initRawData; private readonly _parseSvgPath; private readonly _polygonBounce; private readonly _randomPoint; }