Skip to main content

HTML5 canvas Arrow Tutorial

To create an arrow shape with Konva, we can instantiate a Konva.Arrow() object.

For full list of properties and methods, see the Arrow 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 arrow = new Konva.Arrow({
x: stage.width() / 4,
y: stage.height() / 4,
points: [0, 0, 100, 100],
pointerLength: 20,
pointerWidth: 20,
fill: 'black',
stroke: 'black',
strokeWidth: 4
});

layer.add(arrow);