public float GetEdgePosition_AsFloat(RectTransform.Edge edge, bool extendToLine = false) { var edgeLocal = GetEdgePosition_AsFloat_Local(edge); var parentAxis = TextMesh.rectTransform.GetAxisPosition_AsFloat(edge.Axis()); return(parentAxis + edgeLocal); }
public static float GetEdgePosition_AsFloat(this RectTransform me, RectTransform.Edge edge) { var relevantPosition = me.position[edge.Axis().CoordinateIndex()]; var distanceToEdge = me.DistanceFromPivotToEdge(edge); var edgePosition = relevantPosition + (distanceToEdge * edge.Direction()); return(edgePosition); }
public static RectTransform Align(this RectTransform me, RectTransform.Edge edge, float target) { var edgePosition = me.GetEdgePosition_AsFloat(edge); var offset = target - edgePosition; var offsetVector = new Vector3 { [edge.Axis().CoordinateIndex()] = offset }; me.position += offsetVector; return(me); }
public static Func <GZone <float>, float> Sloper(float amplitude, RectTransform.Edge bottomEdge) { return((zone) => zone.Value + (zone.Coordinate[bottomEdge.Axis().CoordinateIndex()] * amplitude)); }