Reputation: 387
I would like to draw a multiple segment line on a html 5 canvas with variable width per segment.
I tried something like (pseudocode):
beginpath()
setLineWidth(1)
lineTo(0,0)
...
setLineWidth(10)
lineTo(73, 44)
stroke()
but it seems stroke only takes the last linewidth() value? Is there another way?
I tried making every segment its own line, but that turned out really really show when drawing 1000+ segments.
Upvotes: 3
Views: 1305
Reputation: 1967
You have to call stroke()
on each segment, not at the very end and there is no other possiblity.
Upvotes: 2
Reputation: 677
Probably will have to make each segment it's own line. That or figure out how to make a custom shape with the same sort of gradient.
Upvotes: 0