Capturing a sketch drawn with mouse / touch gestures

6:40 PM 10/23/2018 - 5:48 PM 12/27/2018

So.. can you forge John Doe's signature below?

No, this page doesn't intend to support forgery; it only tries to capture a sketch, drawn either with mouse or touch gestures on HTML5 Canvas element. Period.

User's sketch / drawing could then be saved to database for I don't know... just an instant, black and white art collection, maybe?

Removing the hint totally from screen however, gives me an idea to have different kind of login mechanism... now not only the pixels of the signature but also the timing, speed and acceleration; all must be recorded and processed to a backend to make a secure login... whoaa, that's out of this page scope I guess:)

Sorry, your browser doesn't support HTML5 canvas.

HTML

<form id="test" class="with-hint">
	<fieldset>
		<canvas width="300" height="150">Sorry, your browser doesn't support HTML5 canvas.</canvas>
		<label>Name:<input name="name" type="text" value="John Doe" size="8" autocomplete="off"></label>
		<label>Hint:<input name="hint" type="checkbox" checked autocomplete="off"></label>
		<input name="sign" type="hidden" value="">
		<button type="reset">Reset</button>
		<button type="submit">Submit</button>
	</fieldset>
</form>
		

CSS

#test{
	max-width: 50em;
}
#test.with-hint fieldset{
	background: url(john-doe.png) no-repeat top left / 100% auto;
}
#test canvas{
	display: block;
	width: 100%;
	height: auto;
	background-color: rgba(255,255,255,0.9);
}
		

Javascript

Umm, it's quite lengthly to put this one in here, but please locate javascript lines inside <script src="incl/script.js"> by yourself.

Comments