1.2.4 • Published 1 year ago

handwrite-signature v1.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

handWriteSignature

Hand Drawn signature generator for Canvas HTML element. Allows to generate the a unique signature from a string or generate a random signature.

Generate a stroke from points and curves. This is NOT based on fonts.

Installation

yarn add handwrite-signature

Simple Example

handDrawnSign(myCanvas, 'jhonMyers')

results in

example

Complete Example with all options, react and typescript

const cvs = useRef<HTMLCanvasElement>(null); // <canvas ref={cvs} /> somewhere

useEffect( () => {

  var gradient = cvs?.current?.getContext("2d")?.createLinearGradient(0, 0, 170, 0);

  if (gradient){
    gradient.addColorStop(0, "magenta");
    gradient.addColorStop(0.5 ,"blue");
    gradient.addColorStop(1.0, "red");

    handDrawnSign(cvs.current, "kaysersoze8", {lineWidth:2, strokeStyle : gradient, controlPointProportion: 1.7, usableProportionArea:0.7 })

  }

} , [] )

results in

example

How to use

  1. Just call function handDrawnSign with a canvas Element, a string for signature generation (or undefinded for Random ) and optional configuration.

  2. enjoy!

  3. controlPointProportion configures the amplitude of the strokes, so at a very large amplitude the usableProportionArea must be reduced so that the strokes do not come out of the canvas. Default values are conservative = { controlPointProportion: 1.3, usableProportionArea:0.5 }

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago