Skip to main content

HTML5 canvas Wedge Tutorial

To create a wedge (pie piece) shape with Konva, we can instantiate a Konva.Wedge() object.

For full list of properties and methods, see the Wedge API Reference.

import Konva from 'konva';

const stage = new Konva.Stage({
  container: 'container',
  width: window.innerWidth,
  height: window.innerHeight
});

const layer = new Konva.Layer();
stage.add(layer);

const wedge = new Konva.Wedge({
  x: stage.width() / 2,
  y: stage.height() / 2,
  radius: 70,
  angle: 60,
  fill: 'red',
  stroke: 'black',
  strokeWidth: 4,
  rotation: -120
});

layer.add(wedge);