lineTo() - lineTo() - The
lineTo()
method adds a line from the last point in the path to a new point. - Метод lineTo() добавляет линию от последней точки пути к новой точке.
Näide:
const canvas = document.getElementById("myCanvas");
const ctx = canvas.getContext("2d");
// Start a new Path
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(300, 150);
// Draw the Path
ctx.stroke();1
2