1.2.6 • Published 2 months ago

use-freehand v1.2.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

use-freehand

react hook to use perfect-freehand with ease

Install

npm install --save use-freehand

Usage

const FreehandCanvas: FC = () => {
  const canvasRef = useRef<HTMLCanvasElement>(null);
  const { capture, getRawData, reset } = useFreehand(canvasRef);
  return <canvas ref={canvasRef} width={600} height={400} />;
};

Live Demo

API

useFreehand: (canvasRef: RefObject<HTMLCanvasElement>, options?: StrokeOptions) => {
  capture: () => Promise<Blob>;
  getRawData: () => number[][][];
  reset: () => void;
};
  • capture: () => Promise<Blob> captures the image on canvas
  • getRawData: () => number[][][] returns arrays of points
  • reset: () => void clears the canvas
1.2.6

2 months ago

1.2.5

2 months ago

1.2.0

3 months ago

1.2.4

3 months ago

1.2.3

3 months ago

1.2.2

3 months ago

1.2.1

3 months ago

1.1.0

4 months ago

1.0.0

5 months ago