[英]Create hollow circle with Fabric.js
How can I achieve a similar effect like http://jsfiddle.net/Hnw6a/1137/ using Fabric.js? 如何使用Fabric.js达到类似http://jsfiddle.net/Hnw6a/1137/的效果?
I tried with clipTo
but without luck. 我尝试了
clipTo
但没有运气。
I want to update this script http://jsfiddle.net/kxjV5/ to accept 'hollow' circles 我想更新此脚本http://jsfiddle.net/kxjV5/以接受“空心”圈子
Use: 采用:
{
fill: "none",
stroke: "red",
strokeWidth: 5
}
http://jsfiddle.net/eguneys/kxjV5/ http://jsfiddle.net/eguneys/kxjV5/
Well this one is not working on Chrome for sure. 好吧,这肯定不能在Chrome上运行。
{
fill: "none",//should be fill:undefined
stroke: "red",
strokeWidth: 5
}
The fill should be set to undefined
, not none
. 填充应设置为
undefined
而不是none
。
If fill: "none"
doesn't work, try this: 如果
fill: "none"
不起作用,请尝试以下操作:
{
fill: "rgba(0,0,0,0.0)", //setting alpha channel to 0.0 will make fill transparent
stroke: "red",
strokeWidth: 5
}
Actual working solutions, that I found 我发现的实际可行的解决方案
{
fill: 'transparent',
// or: fill: undefined,
// or: fill: "rgba(0,0,0,0.0)", //setting alpha channel to 0.0 will make fill transparent
stroke: "red",
strokeWidth: 5
}
example: https://jsfiddle.net/1dvcrxa8/ 示例: https : //jsfiddle.net/1dvcrxa8/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.