2013-08-30 57 views
1

我想給strokeStyle和strokewidth屬性。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 
}); 
+1

更新的問題在github上更新教程:https://github.com/kangax/fabricjs.com/issues/22 – Kienz

回答

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);