circle-progress icon indicating copy to clipboard operation
circle-progress copied to clipboard

I have one question about using gradient effect with your circle-progress css like below picture.

Open legion7298 opened this issue 3 years ago • 8 comments

KakaoTalk_20210719_225225125

How can I express it?

Could you plz... Sugguest a way? ToT

legion7298 avatar Jul 19 '21 13:07 legion7298

Circle Progress is made with SVG. Unfortunately you can't use CSS gradients on SVG elements.

tigrr avatar Aug 11 '21 07:08 tigrr

i found how make a gradients, checked on the circle-progress library and its worked! here is snippet bellow!

<svg>
  <!-- Gradient (just need to insert in the <svg> tag. The ID must be unique) -->
  <linearGradient id="linear-gradient">
    <stop offset="0%" stop-color="gold"/>
    <stop offset="100%" stop-color="teal"/>
  </linearGradient>

  <!-- add this attribute instead circle stroke color -->
  stroke="url(#linear-gradient)"
</svg>

kulbabskyy avatar Oct 22 '21 18:10 kulbabskyy

@albalirus's suggestion works indeed. See a demo on JSFiddle. If using this approach, please keep in mind:

  1. The gradient will go from side to side, not along the arc.
  2. You will have to include extra markup in your HTML or external SVG and then link that document correctly in your CSS. If both CSS and HTML are in the same file (CSS is inline) you can use fragment shorthand (e .g. #linear-gradient) for gradient URL rather than full path.

@albalirus thanks a lot for your input.

tigrr avatar Oct 25 '21 10:10 tigrr

@tigrr this is good news! Thank you for testing. It is possible to add this gradient feature to the library?

kulbabskyy avatar Oct 25 '21 10:10 kulbabskyy

@albalirus, I am thinking about adding gradient to the library. The complication is that most people want gradient along the arc, and that doesn't seem possible.

tigrr avatar Oct 25 '21 16:10 tigrr

@albalirus, I am thinking about adding gradient to the library. The complication is that most people want gradient along the arc, and that doesn't seem possible.

Hi @tigrr I found very interested technique to make a gradient along the stroke )) https://bl.ocks.org/mbostock/4163057

kulbabskyy avatar Oct 28 '21 23:10 kulbabskyy

@albalirus, I am thinking about adding gradient to the library. The complication is that most people want gradient along the arc, and that doesn't seem possible.

Hi @tigrr I found very interested technique to make a gradient along the stroke )) https://bl.ocks.org/mbostock/4163057

@albalirus thank you for the suggestion and excuse me for late reply. The example you shared fragments the path into multiple small pieces. I think this approach would make it very hard (if possible) to implement animation. And even if implemented, the animation would be jerky.

tigrr avatar Feb 07 '22 08:02 tigrr

@albalirus, I am thinking about adding gradient to the library. The complication is that most people want gradient along the arc, and that doesn't seem possible.

Hi @tigrr I found very interested technique to make a gradient along the stroke )) https://bl.ocks.org/mbostock/4163057

@albalirus thank you for the suggestion and excuse me for late reply. The example you shared fragments the path into multiple small pieces. I think this approach would make it very hard (if possible) to implement animation. And even if implemented, the animation would be jerky.

Hi @tigrr Yes, the animation will be unused in this case. This is just for example.

The first our example is very nice i think. And its not hard to implement in the library. https://jsfiddle.net/tikosar/rcu30s82/

kulbabskyy avatar Feb 07 '22 20:02 kulbabskyy