简体   繁体   English

SVG渐变“切片”

[英]SVG Gradient “Pie Slice”

Is it possible to shade in a corner of a shape using only gradients? 是否可以仅使用渐变在形状的一角着色? Below is an image of what I am trying to do, but had to use a circle and a path. 下面是我要尝试执行的操作的图像,但必须使用圆圈和路径。 I know using a path is probably a better method, but I am curious if it can be accomplished with gradients. 我知道使用路径可能是一种更好的方法,但是我很好奇它是否可以通过渐变来完成。

在此处输入图片说明

Thank you. 谢谢。

Path is not the only method. 路径不是唯一的方法。 Sometimes a 5 year old can outsmart me with basic shapes:- 有时5岁的孩子可以用基本形状胜过我:

<svg class="sheet" xmlns="http://www.w3.org/2000/svg" 
  xlink="http://www.w3.org/1999/xlink" version="1.1" width="200" height="200">

  <pattern id="my_pattern" patternUnits="userSpaceOnUse"
             width="200" height="200" viewbox="0 0 200 200">
  <rect x="0" y="0" fill="#33ff33" width="200" height="200" />
  <rect x="50" y="0" fill="red" width="50" height="50" />
  </pattern>
  <circle cx="50" cy="50" r="40" style="stroke:black; stroke-width: 2; 
   fill: URL(#my_pattern)"/>
</svg>

Not with a single gradient. 没有一个梯度。 No. 没有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM