Skip to main content

HTML5 canvas Ring Tutorial

To create a ring with Konva, you can use the Konva.Ring() object.

For full list of properties and methods, see the Ring 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 ring = new Konva.Ring({
  x: stage.width() / 2,
  y: stage.height() / 2,
  innerRadius: 40,
  outerRadius: 70,
  fill: 'yellow',
  stroke: 'black',
  strokeWidth: 4
});

layer.add(ring);