EaselJS triangle with rounded corners?
How can I create a triangle with rounded corners in EaselJS? I'm using drawPolyStar to create the triangle,
var polystar = new createjs.Shape(); polystar.graphics.drawPolyStar(100, 100, 60, 3, 0, -90);
But actual triangle has sharp corners.
There are no canvas APIs for rounding corners of polygons that works like the roundRect API.
There are a few approaches I can think of:
- Do the round corners yourself using arcTo. This would take some math to figure out, and there may even be some libraries or examples floating around
// Line outer radius context.lineJoin = "round"; context.lineWidth = cornerRadius;
- Using rounded stroke edges, you can sort of fake it. This fiddle shows how a thick line with round ends can make the outer edges look round. You could draw another smaller triangle on top to give the desired effect.