1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00

FixFormat

This commit is contained in:
Thor Brigsted 2019-10-07 09:37:01 +02:00
parent 446611531b
commit a35cd68dd7
3 changed files with 9 additions and 10 deletions

View File

@ -142,8 +142,7 @@ namespace XNodeEditor {
p = new Vector2(-p.y, p.x) * Mathf.Sign(side) * tangentLength; p = new Vector2(-p.y, p.x) * Mathf.Sign(side) * tangentLength;
inputTangent = p; inputTangent = p;
} } else {
else {
inputTangent = Vector2.left * dist_ab * 0.01f * zoom; inputTangent = Vector2.left * dist_ab * 0.01f * zoom;
} }
@ -155,7 +154,7 @@ namespace XNodeEditor {
int division = Mathf.RoundToInt(.1f * dist_ab) + 3; int division = Mathf.RoundToInt(.1f * dist_ab) + 3;
Vector3[] points = Handles.MakeBezierPoints(point_a, point_b, tangent_a, tangent_b, division); Vector3[] points = Handles.MakeBezierPoints(point_a, point_b, tangent_a, tangent_b, division);
// Coloring and bezier drawing. // Coloring and bezier drawing.
for (int j = 0; j < points.Length - 1; j++) { for (int j = 0; j < points.Length - 1; j++) {
Handles.color = gradient.Evaluate((j + 1f) / (points.Length)); Handles.color = gradient.Evaluate((j + 1f) / (points.Length));
Handles.DrawAAPolyLine(bezier_width, points[j], points[j + 1]); Handles.DrawAAPolyLine(bezier_width, points[j], points[j + 1]);
} }
@ -170,7 +169,7 @@ namespace XNodeEditor {
int line_width = 5; int line_width = 5;
// Draws the line with the coloring. // Draws the line with the coloring.
Vector2 prev_point = point_a; Vector2 prev_point = point_a;
for (float j = 0; j < 1; j += 10f / Vector2.Distance(point_a, point_b)) { for (float j = 0; j < 1; j += 10f / Vector2.Distance(point_a, point_b)) {
Vector2 lerp = Vector2.Lerp(point_a, point_b, j); Vector2 lerp = Vector2.Lerp(point_a, point_b, j);
Handles.color = gradient.Evaluate(j); Handles.color = gradient.Evaluate(j);
Handles.DrawAAPolyLine(line_width, prev_point, lerp); Handles.DrawAAPolyLine(line_width, prev_point, lerp);

View File

@ -73,8 +73,8 @@ namespace XNodeEditor {
} }
Gradient grad = new Gradient(); Gradient grad = new Gradient();
grad.SetKeys( grad.SetKeys(
new GradientColorKey[] { new GradientColorKey(a, 0f), new GradientColorKey(b, 1f) }, new GradientColorKey[] { new GradientColorKey(a, 0f), new GradientColorKey(b, 1f) },
new GradientAlphaKey[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) } new GradientAlphaKey[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }
); );
return grad; return grad;
} }