Is it possible to draw one single filled figure on a canvas with different stroke styles?
In other words, can I draw a blue triangle and have a different color on each side?
I understand there is a less optimal solution:
- - a new path, draw a triangle without strokes, fill it, then close the path
- start a new path, redraw the first side with the first color stroke, close the path
- start a new path, redraw the second side with a different color stroke, close the path
- start a new path, redraw the third side with a different color stroke, close the path
In short, draw a completed form without strokes, then redraw each side with a unique stroke style.
This is not very important for a single triangle, but if you have many more complex shapes, it seems ineffective.
So - is it possible to draw one shape with different stroke styles across different segments of the path?
source
share