I'm trying to draw a path for a rounded rectangle where the sides are optional.
The function would look like this:
function drawRoundRect(width, height, sides, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius) {
pathData = "M 0 0...";
}
But I can't figure out the path data.
The user would be able to say:
var myPath = drawRoundRect(100,100,"top left right", 10, 10, 10, 10);
and it would create a rectangle with three sides where the bottom line of the rectangle is not drawn.
Or for a full rectangle they would write this:
var myPath = drawRoundRect(100,100,"top left right bottom", 10, 10, 10, 10);
// top and bottom no rounded corners
var myPath = drawRoundRect(100,100,"top bottom", 0, 0, 0, 0);