Proposed demo: Ink API #35
Replies: 1 comment
-
Thoughts: The purpose of this new API seems to be to mitigate the perceived lag of a drawn line behind the real-time position of the mouse cursor (or a moving finger) - see this nice gif animation from the related MS Edge Blog article introducing the new API. This Chrome Blog post giving an "Inside look at modern web browser" describes the browser practice of minimizing event dispatches to the main thread:
... Which explains the perceived lag very nicely, given that mouse pointer display is completely separate (driven and displayed by the OS, not the browser) and not tied to RAF considerations. However! The documentation is explicit that the Ink API has a very limited scope; its purpose is to render a line on a <canvas> or in <svg> blocks as the cursor/finger moves. The following code shows that the functionality requires us to supply a target, an event and some style data to make anything happen:
Given the limited purpose and scope of the functionality, I'm struggling to see what benefits the Ink API can bring to SC. Devs are always welcome to add it in to their canvas work but, if the aim is to produce smoother hand-drawn lines then there's other approaches that may prove to be more productive - the getPredictedEvents method on the PointerEvent interface, for instance. Conclusion: Will not progress further. |
Beta Was this translation helpful? Give feedback.
-
Proposal:
The Ink API allows browsers to directly make use of available OS-level compositors when drawing pen stokes in an inking app feature, thereby reducing latency and increasing performance.
Discussion:
SC does not support on-screen freehand line drawing out of the box, instead expecting devs to build their own (responsive and accessible) UI for such functionality - see the Canvas-032 demo for an example of this.
If there's a possibility that we could use the Ink API (which I've not heard of before) to make it easier for devs to build such functionality into their canvas products/graphics then it would be good to offer them a demo showing (one way) of doing just that.
Depending on the results of the demo, there may be scope to offer an even easier solution from within SC itself? Maybe as a new Entity??
Risks:
This API seems to be a Google/Chrome initiative - there's no indication that it will ever be supported by Firefox/Safari
Beta Was this translation helpful? Give feedback.
All reactions