Weave.js

Regular Polygon

Draw a regular polygon on the canvas

Regular Polygon on Weave.js showcase

The Regular Polygon node is a simple, versatile primitive shape used to render star elements on the canvas. Built on top of Konva’s RegularPolygon, it supports customizable properties such as amount of sides, position, radius, fill color, stroke, radius (on both axis), and more.

They can also respond to interactions like dragging, resizing, or selection.

Usage

Import the Node

Start by importing the node:

import { WeaveRegularPolygonNode } from "@inditextech/weave-sdk";

Register the Node

Then register the node on the Weave class instance.

const instance = new Weave({
  ...
  nodes: [
    ...,
    new WeaveRegularPolygonNode(), 
  ]
})

Use the node

Once the node is registered you can use it on Actions or Plugins or even other Nodes.

We provide an action named Regular Polygon Tool that allows users to add Regular Polygon nodes to the application.