why conic gradients cause aliasing when the value is an integer %?

compare both images. if i add 0.5, it looks smooth, if i don't then it looks jagged and ugly. why would it do this? is it performance traded for looks? but this is super jarring and ugly. can i even force it to use anti-aliasing without having to add 0.5?
No description
No description
21 Replies
Shane
Shane8mo ago
that is just how it's implemented
ἔρως
ἔρωςOP8mo ago
it clearly can handle not looking like a staircase, so
Shane
Shane8mo ago
When I had to do something similar (pie chart) I built a SVG generator because I couldn't get conic gradients to do antialiasing
ἔρως
ἔρωςOP8mo ago
i add 0.5 to the value, and it works
Shane
Shane8mo ago
If you do everything at perfect 1/8th? increments it looks fine iirc
ἔρως
ἔρωςOP8mo ago
but, as you can imagine, i would rather not
Shane
Shane8mo ago
its ugly though its blurred, not true aliasing
ἔρως
ἔρωςOP8mo ago
i know but it's close enough for what i needed it for what i need, the svg generator won't work, as i need html and css
Shane
Shane8mo ago
html can do svg directly tho You could also do it with clip path and some math in CSS if you hate yourself
ἔρως
ἔρωςOP8mo ago
yes, but i need it to update with just css and html
Shane
Shane8mo ago
svg animations exist
ἔρως
ἔρωςOP8mo ago
i know but i didn't knew how to make them work at the time i wrote that
Choo♚𝕂𝕚𝕟𝕘
I never see this problem when I use degrees instead of percents.
ἔρως
ἔρωςOP8mo ago
does it work well with rads instead of degrees?
Shane
Shane8mo ago
it has the same issue with degrees
Shane
Shane8mo ago
@ἔρως here is my cursed clip path solution https://codepen.io/Thisisntme/pen/LYvojPd
Shane
CodePen
LYvojPd
...
ἔρως
ἔρωςOP8mo ago
that works. it's a pain to implement, but works
Choo♚𝕂𝕚𝕟𝕘
Are you using the exact same starting value as the ending value of the previous color? It has to be slightly off. When I use degrees, I add 0.2 degrees to the next value. For example:
background-image: conic-gradient(blue 47deg, white 47.2deg);
background-image: conic-gradient(blue 47deg, white 47.2deg);
This should also work with percents, but I don't know the proper amount to add.
ἔρως
ἔρωςOP8mo ago
no, i add 0.5
MarkBoots
MarkBoots8mo ago
i like to put the colorstops in custom vars and calc the "bleed" both ways. that way it's easy to change and the actual switch of the color happens on the meant value It's a bit more code, but easier to control
--stop1: 47deg;
--bleed: .5deg;
background-image: conic-gradient(
blue calc(var(--stop1) - var(--bleed) / 2)),
white calc(var(--stop1) + var(--bleed) / 2))
);
--stop1: 47deg;
--bleed: .5deg;
background-image: conic-gradient(
blue calc(var(--stop1) - var(--bleed) / 2)),
white calc(var(--stop1) + var(--bleed) / 2))
);
ἔρως
ἔρωςOP8mo ago
that is interesting
Want results from more Discord servers?
Add your server