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

后端 未结 11 660
时光说笑
时光说笑 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:35

    As Daniel Howard points out, Rob Spencer describes what you want at http://scaledinnovation.com/analytics/splines/aboutSplines.html.

    Here's an interactive demo: http://jsbin.com/ApitIxo/2/

    Here it is as a snippet in case jsbin is down.

    
        
          
            
            Demo smooth connection
          
          
            
    Click to build a smooth path. (See Rob Spencer's article)


提交回复
热议问题