gpt4 book ai didi

javascript - strokestyle 和 strokewidth 属性不起作用

转载 作者:行者123 更新时间:2023-11-28 13:12:48 25 4
gpt4 key购买 nike

我想给 strokeStyle 和 strokewidth 属性。

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

fiddle ::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
});

最佳答案

我认为该文档中存在错误,或者可能是语法已更改,试试这个代码,我已经测试过了..它有效..

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

关于javascript - strokestyle 和 strokewidth 属性不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18530752/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com