cornerRadius(topLeft_or_all, topRight, bottomRight, bottomLeft)
Class: Rectangle.
Description:
Sets or gets a corner radius for each corner separately or for all corners at once.
This method sets same width and height of the arc. If you need to set arc with different width and height, you can use Rectangle > cornerArc method: cornerArc(...).
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
number | string | object | undefined |
Radius for top-left corner, a |
|
|
number | undefined |
Radius for top-right corner. If omitted, it defaults to topLeft corner. |
|
|
number | undefined |
Radius for bottom-right corner. If omitted, it defaults to topRight corner. |
|
|
number | undefined |
Radius for bottom-left corner. If omitted, it defaults to bottomRight corner. |
Returns:
If called without parameters or topLeft is undefined, current corner radius object is returned. If called with arguments, this Rectangle shape is returned for chaining.
Type: Object | Rectangle
Examples:
3 ways to set radius for each corner separately:
rectangle.cornerRadius(10, 10, 0, 0); // as separate parameters
rectangle.cornerRadius("10 10 0 0"); // in a string (CSS style)
rectangle.cornerRadius({tl:10, tr:10, br:0, bl:0}); // In same object format as this method returns
Setting radius for all corners at once:
rectangle.cornerRadius(10);
