I want to create a web page where the user would be able to write their signature using a stylus (like when you sign for a parcel or package). Does anyone know if this is possible? I'm not sure exactly where to start but I'm guessing that I would have to use the element and javascript?
It's perfectly possible as long as the device your client will be using supports touch input using stylus.
You can see this tutorial to see how to use <canvas>
element to create a simple drawing app.
To see which browsers support canvas, see this page.
If you specifically want stylus support, you'll want to support features beyond the typical mouse x,y coordinates.
Currently, only stylus-specific input I know of is the Wacom Web plugin/API. This supports these features like stylus pressure, stylus angle, and multi-touch for the web.
http://www.wacomeng.com/web/
Future considerations for a HTML5's 'pointerevents' API generically supporting pressure, angle and touch events for all tablet types are proposed here.
http://www.w3.org/TR/pointerevents/
There is no API specific to a stylus which supports things like pressure-sensitivity or orientation. But in most cases a stylus can be used as a mouse. In this case it will create normal mouse events like mousedown
, mousemove
and mouseup
. You can add event handlers for these events to your canvas and react to them appropriately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With