在html5 canvas中,可以为行结束指定风格。
例如:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.lineCap="round"; // <-- here lineCap is specified
ctx.moveTo(20,20);
ctx.lineTo(200,20);可能的选择是:butt (Default), round, square。
我的问题是:
使用lineCap创建Line时如何指定fabric.js样式
var line = new fabric.Line(
[0, 100, 200, 100],
{
strokeWidth: 5
// I presume some option should be specified here, but how is it should be called?
}
);发布于 2017-02-05 17:26:23
我找到了答案
在这里发布它,因为从fabric.js文档中看不出来:
var line = new fabric.Line(
[0, 100, 200, 100],
{
strokeWidth: 5,
strokeLineCap: "round" // <-- this makes 'round' line ends style
}
);https://stackoverflow.com/questions/42053827
复制相似问题