[英]Svg polygon with angulart gradient
I am trying to implement angular gradient with svg polygon.我正在尝试使用 svg 多边形实现角度渐变。 Any ideas about gradient?
关于渐变的任何想法? I need something like that.
我需要这样的东西。
Gradient parameters: Angular Gradient #F7891F #FFAD2B渐变参数:角度渐变#F7891F #FFAD2B
What i have now:我现在所拥有的:
The code for implementing this:实现这个的代码:
<Defs>
<clipPath id='graph-clip'>
<polygon
id='graph-shape'
points={pointsForOuterDiagram}
/>
</clipPath>
</Defs>
<use
xlinkHref='#graph-shape'
fill='#fff'
stroke='#FECC7F'
strokeWidth='10'
className={styles.outerDiagram}
/>
<use
xlinkHref='#graph-shape'
fill='none'
stroke='#FEA929'
strokeWidth='10'
clipPath='url(#graph-clip)'
className={styles.innerDiagram}
/>
I think, I found the solution by imitating angular gradient with linear.我想,我通过模拟线性角度梯度找到了解决方案。 Angular gradients are created when x1 and x2 differ and y1 and y2 differ.
当 x1 和 x2 不同且 y1 和 y2 不同时,会创建角度梯度。
Added:添加:
<linearGradient
x1='50%'
y1='50%'
x2='100%'
y2='100%'
id='gradient'
>
<stop stopColor='#FDC87D' offset='0%' />
<stop stopColor='#FAB878' offset='100%' />
</linearGradient>
<linearGradient
x1='50%'
y1='50%'
x2='100%'
y2='100%'
id='inner'
>
<stop stopColor='#FEAC2A' offset='0%' />
<stop stopColor='#F7891F' offset='100%' />
</linearGradient>
So now it looks like that:所以现在看起来像这样:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.