1

我想给 strokeStyle 和 strokewidth 属性。

我正在尝试来自http://fabricjs.com/fabric-intro-part-2/#text的示例,但我无法在我的屏幕上看到任何效果??

小提琴 :: http://jsfiddle.net/gvn3X/1/

var textWithStroke = new fabric.Text("Text with a stroke", {
  strokeStyle: '#ff1318',
  strokeWidth: 1
});
var loremIpsumDolor = new fabric.Text("Lorem ipsum dolor", {
  fontFamily: 'Impact',
  strokeStyle: '#c3bfbf',
  strokeWidth: 3
});
4

1 回答 1

2

我认为该文档中存在错误,或者可能是语法已更改,请尝试此代码,我已经对其进行了测试..它可以工作..

var canvas = window._canvas = new fabric.Canvas('c');
  var text = new fabric.Text('Sample', {
 left: 100,
top: 100,
fill: 'navy',

 stroke: '#c3bfbf',
  strokeWidth: 3
 });
 var textWithStroke = new fabric.Text("Text with a stroke", {
 fontFamily: 'Impact',
  stroke: '#333',
   strokeWidth: 3,
   });
  canvas.add(text);
 canvas.add(textWithStroke);
于 2013-08-30T11:01:39.947 回答