how to draw smooth curve through N points using javascript HTML5 canvas?

后端 未结 11 665
时光说笑
时光说笑 2020-11-22 16:40

For a drawing application, I\'m saving the mouse movement coordinates to an array then drawing them with lineTo. The resulting line is not smooth. How can I produce a sing

11条回答
  •  独厮守ぢ
    2020-11-22 17:18

    Give KineticJS a try - you can define a Spline with an array of points. Here's an example:

    Old url: http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-spline-tutorial/

    See archive url: https://web.archive.org/web/20141204030628/http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-spline-tutorial/

提交回复
热议问题