class Shape

Description:

Shape class is used to create shapes to be drawn in the background of Window or Panel. This class is usually extended by other shapes. It can be used by itself only if path argument is provided.

Path of the shape can be generated by adding, subtracting, or intersecting two shapes, then convert the Shape to JSON object using shape.toObject(). Then resulting object will have path property.

Check out all the shapes that derive from this Shape class: Arc, Ellipse, Line, Polygon, Polyline, Rectangle, and Text that can draw text as a shape.

Constructor

constructor([path], [stroke], [background], [opacity=1], [x=0], [y=0])

Shape constructor.

Parameters:

Name Type Default Description

[path]

string

Path consisting of points. It can be auto-generated by performing operations of one shape to another, such as add() or subtract().

[stroke]

Stroke

A border of the shape.

[background]

string

Color, gradient, image, and background options like in CSS.

[opacity]

number

1

Opacity of the shape as a decimal between 0 and 1.

[x]

number

0

Position of the shape from left edge.

[y]

number

0

Position of the shape from the top.

Members

Methods

From this class: