create-puzzle
Version:
在浏览器端生成滑块验证码的拼图和背景图。
28 lines (27 loc) • 749 B
TypeScript
export declare enum Point {
None = "none",
Outer = "outher",
Inner = "inner"
}
export declare const pointArray: Point[];
export declare function getRandomInt(max: number, min?: number): number;
export declare function getRandomPoints(pointNum?: 2 | 3 | 4): {
top: Point;
right: Point;
bottom: Point;
left: Point;
};
export declare function drawPuzzle(ctx: CanvasRenderingContext2D, options?: {
x?: number;
y?: number;
w?: number;
h?: number;
points?: 2 | 3 | 4 | {
top: Point;
right: Point;
bottom: Point;
left: Point;
};
margin?: number;
}): void;
export declare function internalLoadImage(image: string | Blob, useCache?: boolean): Promise<HTMLImageElement>;