/// <summary> Sets the Gradient Fill parameters of the RageSpline </summary> /// <param name="spline"> </param> private void ApplyFillGradient(RageSvgPathElement path, RageSvgStyle style) { var gradient = style.RageSvgGradient; var start = new Vector2(gradient.X1, gradient.Y1); var end = new Vector2(gradient.X2, gradient.Y2); if (DebugStyleCreation) { Debug.Log("\tGradient Start Color:" + gradient.StartColor); } path.Spline.FillGradient.StartColor = gradient.StartColor; path.Spline.FillGradient.EndColor = gradient.EndColor; path.Spline.FillGradient.StyleLocalPositioning = true; path.Spline.FillGradient.Offset = (start + end) / 2; path.Spline.FillGradient.Scale = 1 / ((end - start) / 2).magnitude; //Debug.Log("current: "+current.Spline.name+" | start-end x/y : "+ start.x +" "+ start.y+" "+end.x+" "+end.y); var gradientAngle = ColorExtension.CalcTheta(new Vector2(gradient.X1, gradient.Y1), new Vector2(gradient.X2, gradient.Y2)); if (DebugStyleCreation) { Debug.Log("\tGradient Angle: " + gradientAngle); } path.Spline.FillGradient.Angle = gradientAngle; }