Drawing lines with continuously varying line width on HTML canvas

前端 未结 3 634
一向
一向 2021-02-02 00:13

I\'m trying to draw a line that starts as a thin line and then gadually widens until the end. I need to draw semi-smooth curves (composite out of several straight lines) and I\'

3条回答
  •  长发绾君心
    2021-02-02 00:24

    Another way you can solve this is to consider each of you plot points to be a circle of a radius determined by the velocity.

    plot paths joining the profile-edges of these circles (straight or curved, your choice), first over the top, round the last and back to the start on the underside. Then fill the path at the end.

    This should give you a smooth line expanding and contracting as it approaches you plot point 'circles'.

提交回复
热议问题