@zsviczian/excalidraw
Version:
Excalidraw as a React component
41 lines (40 loc) • 1.32 kB
TypeScript
import { LaserPointer } from "@excalidraw/laser-pointer";
import type { LaserPointerOptions } from "@excalidraw/laser-pointer";
import type App from "./components/App";
export interface Trail {
start(container: SVGSVGElement): void;
stop(): void;
startPath(x: number, y: number): void;
addPointToPath(x: number, y: number): void;
endPath(): void;
}
export interface AnimatedTrailOptions {
fill: (trail: AnimatedTrail) => string;
stroke?: (trail: AnimatedTrail) => string;
animateTrail?: boolean;
}
export declare class AnimatedTrail implements Trail {
protected app: App;
private options;
private currentTrail?;
private pastTrails;
private container?;
private trailElement;
private trailAnimation?;
private key;
private static counter;
constructor(app: App, options: Partial<LaserPointerOptions> & Partial<AnimatedTrailOptions>);
get hasCurrentTrail(): boolean;
hasLastPoint(x: number, y: number): boolean;
private cleanup;
start(container?: SVGSVGElement): void;
stop(): void;
startPath(x: number, y: number): void;
addPointToPath(x: number, y: number): void;
endPath(): void;
getCurrentTrail(): LaserPointer | undefined;
clearTrails(): void;
private update;
private onFrame;
private drawTrail;
}