import sLine from 'canvas-s-line';
import createCanvas from 'canvas-tree';
const style = {
fromx: 60,
fromy: 80,
tox: 130,
toy: 120,
stroke: '#3333ff',
strokeWidth: 2,
hover: {
stroke: '#ff3333'
}
}
const $canvas = document.getElementById('canvas');
const canvas = createCanvas($canvas);
canvas.update({
children: [
{
geometry: sLine,
children: [],
style
}
]
});
const path = sLine(style);
const ctx = $canvas.getContext('2d');
ctx.lineWidth = style.strokeWidth;
ctx.strokeStyle = style.stroke;
ctx.stroke(path);