improve zebra bar chart

This commit is contained in:
monitor1394
2022-01-06 21:47:21 +08:00
parent f64a82b340
commit 77c5c6af7e

View File

@@ -311,12 +311,12 @@ namespace XUGL
var sp = startPoint; var sp = startPoint;
var np = Vector3.zero; var np = Vector3.zero;
var isGradient = !color.Equals(toColor); var isGradient = !color.Equals(toColor);
zebraWidth = (maxDistance - zebraGap * (allSegment - 1)) / allSegment;
for (int i = 1; i <= segment; i++) for (int i = 1; i <= segment; i++)
{ {
np = startPoint + dir * maxDistance * i / allSegment; np = sp + dir * zebraWidth;
var dashep = np - dir * zebraGap; DrawLine(vh, sp, np, width, isGradient ? Color32.Lerp(color, toColor, i * 1.0f / allSegment) : color);
DrawLine(vh, sp, dashep, width, isGradient ? Color32.Lerp(color, toColor, i * 1.0f / allSegment) : color); sp = np + dir * zebraGap;
sp = np;
} }
} }