如何完全精确地设置半径线性梯度%

问题描述 投票:0回答:1

我正在测试此代码:

 <svg height="150" width="150">
      <defs>
        <radialGradient id="grad1" cx="80%" cy="20%" r="100%" fx="100%" fy="50%">
          <stop offset="0%" style="stop-color:rgb(0,0,255);stop-opacity:1" />
          <stop offset="100%" style="stop-color:rgb(0,200,255);stop-opacity:1" />
        </radialGradient>
      </defs>
      <ellipse cx="100" cy="100" rx="30" ry="30" stroke="url(#grad1)" stroke-width="3" fill="none" stroke-linecap="round" stroke-dasharray="200" stroke-dashoffset="20" transform-origin="100 100" transform="rotate(-95)"/>
    </svg>

我已经使用stroke-dasharray =“ 200”和stroke-dashoffset =“ 20”进行了测试,这是我找到的最准确的值。基于this,我必须找到用于设置圆百分比的值。使用troke-dasharray =“ 200” stroke-dashoffset =“ 20”时,圆圈可实现10%跳跃的功能,但是当我想将值设置为91%-99%之间时,圆圈似乎已完成。值接近0%时,圆圈看起来像是空的。

我需要完全准确地设置圆的百分比,并且不能旋转。 (圆圈必须从圆圈的顶部开始)

抱歉,如果我的英语不完美。谢谢。

svg ellipse radial-gradients
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.