Implementing smooth sketching and drawing on the element

前端 未结 7 641
粉色の甜心
粉色の甜心 2021-01-29 20:20

I am trying to create a drawing area with canvas. I am having trouble with making the lines look smooth when drawing curves and I also have changing line thickness in my algorit

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-29 20:48

    Seems that you need to use some brushes in your canvas. It's hard to say what kind of brush exactly you need but there is many JS libraries that has already implement brush technology.

    For example did you look at this libraries?

    • Processing.js
    • HTML5-Canvas-Brush-Sketch (demo and article how it works)

    Laso in web you can find many brushes implemented in Mr. Doob Harmony project. For example stringy or Harmony-Brushes project on github.

提交回复
热议问题