Ellipse

Ellipse shape can draw an oval (when height and width are different) or a circle (when height and width are same).

Ellipse extends the Shape class.

Constructor

new Ellipse(strokeopt, backgroundopt, opacityopt, xopt, yopt, widthopt, heightopt)

Creates an instance of Arc shape.

Parameters:
NameTypeAttributesDefaultDescription
strokeStroke<optional>

A border of the shape.

backgroundstring<optional>

Color, gradient, or image background, similar to CSS. Use an empty string to remove the background.

opacitynumber<optional>
1

Opacity of the shape (0 to 1).

xnumber<optional>
0

Horizontal position from the left edge.

ynumber<optional>
0

Vertical position from the top edge.

widthnumber<optional>
100

Width of the ellipse (horizontal diameter).

heightnumber<optional>

Height of the ellipse (vertical diameter). If omitted, height will be same as width.

Classes

Ellipse

Methods

size(width, heightopt) → {Size|Ellipse}

Sets or gets the size of the Ellipse (horizontal and vertical diameter).

Parameters:
NameTypeAttributesDescription
widthnumber | Size

Width of the ellipse (horizontal diameter), or a Size object (e.g., {width:300,height:300}).

heightnumber<optional>

Height of the ellipse (vertical diameter).

See
Returns:

If called without parameters, current size is returned; otherwise this Ellipse object is returned.

Type: 
Size | Ellipse

toObject(includeopt) → {object}

Returns a JSON object that contains this shape properties. It may be converted back to this shape.

Parameters:
NameTypeAttributesDefaultDescription
includestring<optional>
"all"

Specified what to include. "all" is default. Valid values are: "all", "stroke", "background", "points", "basic".

Returns:

Returns an object containing this shape's properties.

Type: 
object