gpt4 book ai didi

svg - (RaphaelJS)-如何填充路径的内部?

转载 作者:行者123 更新时间:2023-12-04 11:55:25 26 4
gpt4 key购买 nike

我有一个RaphaelJS库的路径,我似乎无法获得填充来更改其颜色。

var mypage = ScaleRaphael('mainContainer', 1000, 1000);
mypage.setStart();
mypath.path('M794.33,21.5l152.3-0.76L946,21.5v-0.22l1.39,0.01l-1.17,206.61l-0.04,0.3l-0.15,0.27l-0.04,0.07l-0.18,0.35l-0.34,0.2 L786.4,321.59l-159.22,92.27l-2.12,1.18l-0.07-2.36v-1v-0.28l0.18-0.26l42.1-97.5l42.26-97.43l21.13-48.71l21.21-48.68 L794.33,21.5z M794.33,21.5l-41.46,97.76l-20.76,48.87l-20.84,48.83l-41.68,97.67l-41.78,97.59l0.18-0.54v1l-2.11-1.18 l159.08-92.46l159.23-92.21l-0.52,0.54l0.03-0.07l-0.14,0.57l2.04-206.6l1.39,0.01v0.22l0.13,0.77l-0.69,0L794.33,21.5z')
.attr({"type":"path","stroke":"none","fill":"blue"});

路径创建正确,但是fill属性仅使笔触变为蓝色,而不使填充变为蓝色,我在做什么错?

最佳答案

您的路径形状像笔触,通过删除从第二个M开始的所有内容来使其填充以修改路径:

var stage = Raphael('stage',1000, 1000);
var path = stage.path('M794.33,21.5l152.3-0.76L946,21.5v-0.22l1.39,0.01l-1.17,206.61l-0.04,0.3l-0.15,0.27l-0.04,0.07l-0.18,0.35l-0.34,0.2 L786.4,321.59l-159.22,92.27l-2.12,1.18l-0.07-2.36v-1v-0.28l0.18-0.26l42.1-97.5l42.26-97.43l21.13-48.71l21.21-48.68 L794.33,21.5z')
.attr({"type":"path","stroke":"none","fill":"blue"});​

http://jsfiddle.net/YzMCG/

关于svg - (RaphaelJS)-如何填充路径的内部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13660643/

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