Nez.Portable/Math/Mathf.cs
/// <summary>
/// moves start towards end by shift amount clamping the result. start can be less than or greater than end.
/// example: start is 2, end is 10, shift is 4 results in 6
/// </summary>
/// <param name="start">Start.</param>
/// <param name="end">End.</param>
/// <param name="shift">Shift.</param>
moves start towards end by shift amount clamping the result. start can be less than or greater than end.
example: start is 2, end is 10, shift is 4 results in 6
moves start towards end by shift amount clamping the result . start can be less than or greater than end . example : start is 2 end is 10 shift is 4 results in 6
[MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float approach(float start, float end, float shift)
        {
            if (start < end)
                return Math.Min(start + shift, end);
            return Math.Max(start - shift, end);
        }
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ] public static float approach ( float start , float end , float shift ) { if ( start < end ) return Math . Min ( start + shift , end ) ; return Math . Max ( start - shift , end ) ; }
moves start towards end by shift amount clamping the result.
moves start towards end by shift amount clamping the result .
start
float
None
end
float
None
shift
float
None