SketchAPI icon indicating copy to clipboard operation
SketchAPI copied to clipboard

Ability to specify number of points of a polygon

Open KevinGutowski opened this issue 6 years ago • 0 comments

Doesn’t seem like there is an easy way to change the number of sides of a polygon. Similar with the Star object, there should be a way with the API to set the number of points and the radius.

let sketch = require('sketch')
let document = sketch.getSelectedDocument()
let page = document.selectedPage
let ShapePath = sketch.ShapePath

let myHex = new ShapePath({
    shapeType: ShapePath.ShapeType.Polygon,
    parent: page,
    frame: { x: 218, y: 142, width: 120, height: 120 },
    style: { fills: ['#FF00B3']}
})
myHex.sketchObject.setNumberOfPoints(8)

setNumberOfPoints does seem to change the slider but doesn’t update the object properly.

KevinGutowski avatar Apr 19 '19 08:04 KevinGutowski