D
D
dom1n1k2011-02-22 22:41:33
JavaScript
dom1n1k, 2011-02-22 22:41:33

Variable Width Lines in HTML5 Canvas

Is there a JS library that can draw on canvas lines with variable width?

Well, that is, for example: at the beginning, the thickness is 3px, at the end 5px, and so that it changes smoothly along the entire line.

For straight lines, this is, in principle, not very difficult to implement. But for Bezier curves, the solution is non-trivial.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lashtal, 2011-02-23
@lashtal

well, the obvious way is to cut the curve into many segments, each slightly thicker than the previous one.

K
Keyten, 2012-09-13
@Keyten

> For straight lines, this, in principle, is not very difficult to implement Take a
closer look at PaperJS: it can, for example, draw dashed lines, turn Bezier curves into normal segments and vice versa.
PS There will be time, I'll try to do something similar ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question