Drawing smooth lines with canvas

前端 未结 2 1416
遥遥无期
遥遥无期 2020-12-09 13:55

So far none of the threads here on smooth lines are correct.

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

Smooth user drawn lines

2条回答
  •  误落风尘
    2020-12-09 14:38

    You need to keep the same tangent in the points bellowing in the line. Check http://jsfiddle.net/FHKuf/4/.

    Edit:

    Sorry, just noticed your comment today. Just happened to be testing something related and remembered your question. It happens that in the past I did wrote some code to interpolate some lines. It is called Catmull-Rom(just a ref. that I googleed) it passes by the middle control points. I did changed the code to my test and thought that you may have some use to it. See at http://jsfiddle.net/FHKuf/6/.

提交回复
热议问题