points([points])

Class: Polygon.

Description:

Sets an array of new points, or get an array of existing point.

Parameters:

Name Type Description

[points]

Array.<Point>

An array of new point objects [{x:number, y:number}, ...]. Omit to get current point.

Returns:

When called without arguments, returns current points; otherwise returns this Polygon for method chaining.

Type: Array.<Point> | Polygon

Examples:

Getting existing points as an Array:

let _points = polygon.points(); // -> array of objects

Setting a new array of points:

polygon.points({
    {x:10, y:10},
    {x:40, y:10},
    {x:60, y:60},
    {x:30, y:60},
    {x:10, y:10}
});

Also See: