Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
legion7298 opened this issue Jul 19, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@legion7298
Copy link

KakaoTalk_20210719_225225125

How can I express it?

Could you plz... Sugguest a way? ToT

@tigrr
Copy link
Owner

tigrr commented Aug 11, 2021

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

@kulbabskyy
Copy link

kulbabskyy commented Oct 22, 2021

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>

@tigrr
Copy link
Owner

tigrr commented Oct 25, 2021

@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.

@kulbabskyy
Copy link

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

@tigrr
Copy link
Owner

tigrr commented Oct 25, 2021

@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.

@kulbabskyy
Copy link

kulbabskyy commented Oct 28, 2021

@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

@tigrr
Copy link
Owner

tigrr commented Feb 7, 2022

@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.

@kulbabskyy
Copy link

@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/

@tigrr tigrr added the enhancement New feature or request label Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants