diff --git a/CHANGELOG-EN.md b/CHANGELOG-EN.md index 7c9e26ce..57fc1aa4 100644 --- a/CHANGELOG-EN.md +++ b/CHANGELOG-EN.md @@ -39,6 +39,7 @@ ## master +* (2021.08.31) Optimized the gradient effect of `RingChart` * (2021.08.31) Fixed bug where `SerieLabel` does not refresh when `DataZoom` is dragged (#165) * (2021.08.25) Fixed an issue where the theme switch could not be save to the scene (#166) * (2021.08.24) Added `Animation`'s `alongWithLinePath` diff --git a/CHANGELOG.md b/CHANGELOG.md index 2455fc29..c9e8b4b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ ## master +* (2021.08.31) 优化`RingChart`的渐变效果 * (2021.08.31) 修复`DataZoom`拖动时`SerieLabel`不刷新的问题 (#165) * (2021.08.25) 修复`Theme`主题切换无法保持到场景上的问题 (#166) * (2021.08.24) 增加`Animation`的`alongWithLinePath`参数设置折线轨迹匀速动画 diff --git a/Runtime/Internal/DrawSerieRing.cs b/Runtime/Internal/DrawSerieRing.cs index 6c01e9c8..8cdb4117 100644 --- a/Runtime/Internal/DrawSerieRing.cs +++ b/Runtime/Internal/DrawSerieRing.cs @@ -104,6 +104,14 @@ namespace XCharts itemStyle.backgroundColor, Color.clear, 0, 360, borderWidth, borderColor, 0, chart.settings.cicleSmoothness, false, serie.clockwise); } + var isGradient = !UGLHelper.IsValueEqualsColor(itemColor, itemToColor); + if (isGradient) + { + if (serie.clockwise) + itemToColor = Color.Lerp(itemColor, itemToColor, toDegree / (startDegree + 360)); + else + itemToColor = Color.Lerp(itemToColor, itemColor, toDegree / (startDegree + 360)); + } UGL.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius, outsideRadius, itemColor, itemToColor, Color.clear, startDegree, toDegree, borderWidth, borderColor, 0, chart.settings.cicleSmoothness, roundCap, serie.clockwise);