Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

//[assembly: Preserve]
//[assembly: InternalsVisibleTo("SatorImaging.Tests.UnityFundamentals")]
[assembly: InternalsVisibleTo("ExpectedValueGenerator")]


/* ===== SPECIAL ACCESSIBILITY ===== */
Expand Down
158 changes: 86 additions & 72 deletions Burst/Mathematics/EasingDouble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,45 +60,63 @@ public struct EasingDouble
{
/* Quad ================================================================ */
/// <summary>Quadratic easing (Entering).</summary>
public static PRECISION QuadIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x * x); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION QuadIn(PRECISION x) => QuadIn_Raw(x);
/// <summary>Quadratic easing (Exiting).</summary>
public static PRECISION QuadOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : 1.0 - ((1.0 - x) * (1.0 - x))); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION QuadOut(PRECISION x) => QuadOut_Raw(x);
/// <summary>Quadratic easing (Entering and Exiting).</summary>
public static PRECISION QuadInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? 2.0 * x * x : 1.0 - (((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * 0.5)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))
public static PRECISION QuadInOut(PRECISION x) => QuadInOut_Raw(x);

[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION QuadIn_Raw(PRECISION x) => x * x;
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION QuadOut_Raw(PRECISION x) => 1.0 - ((1.0 - x) * (1.0 - x));
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION QuadInOut_Raw(PRECISION x) => x < 0.5 ? 2.0 * x * x : 1.0 - (((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * 0.5);

/* Cubic ================================================================ */
/// <summary>Cubic easing (Entering).</summary>
public static PRECISION CubicIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x * x * x); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION CubicIn(PRECISION x) => CubicIn_Raw(x);
/// <summary>Cubic easing (Exiting).</summary>
public static PRECISION CubicOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : 1.0 - ((1.0 - x) * (1.0 - x) * (1.0 - x))); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION CubicOut(PRECISION x) => CubicOut_Raw(x);
/// <summary>Cubic easing (Entering and Exiting).</summary>
public static PRECISION CubicInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? 4.0 * x * x * x : 1.0 - (((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * 0.5)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))
public static PRECISION CubicInOut(PRECISION x) => CubicInOut_Raw(x);

[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION CubicIn_Raw(PRECISION x) => x * x * x;
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION CubicOut_Raw(PRECISION x) => 1.0 - ((1.0 - x) * (1.0 - x) * (1.0 - x));
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION CubicInOut_Raw(PRECISION x) => x < 0.5 ? 4.0 * x * x * x : 1.0 - (((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * 0.5);

/* Quart ================================================================ */
/// <summary>Quartic easing (Entering).</summary>
public static PRECISION QuartIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x * x * x * x); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION QuartIn(PRECISION x) => QuartIn_Raw(x);
/// <summary>Quartic easing (Exiting).</summary>
public static PRECISION QuartOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : 1.0 - ((1.0 - x) * (1.0 - x) * (1.0 - x) * (1.0 - x))); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION QuartOut(PRECISION x) => QuartOut_Raw(x);
/// <summary>Quartic easing (Entering and Exiting).</summary>
public static PRECISION QuartInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? 8.0 * x * x * x * x : 1.0 - (((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * 0.5)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))
public static PRECISION QuartInOut(PRECISION x) => QuartInOut_Raw(x);

[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION QuartIn_Raw(PRECISION x) => x * x * x * x;
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION QuartOut_Raw(PRECISION x) => 1.0 - ((1.0 - x) * (1.0 - x) * (1.0 - x) * (1.0 - x));
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION QuartInOut_Raw(PRECISION x) => x < 0.5 ? 8.0 * x * x * x * x : 1.0 - (((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * 0.5);

/* Quint ================================================================ */
/// <summary>Quintic easing (Entering).</summary>
public static PRECISION QuintIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x * x * x * x * x); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION QuintIn(PRECISION x) => QuintIn_Raw(x);
/// <summary>Quintic easing (Exiting).</summary>
public static PRECISION QuintOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : 1.0 - ((1.0 - x) * (1.0 - x) * (1.0 - x) * (1.0 - x) * (1.0 - x))); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION QuintOut(PRECISION x) => QuintOut_Raw(x);
/// <summary>Quintic easing (Entering and Exiting).</summary>
public static PRECISION QuintInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? 16.0 * x * x * x * x * x : 1.0 - (((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * 0.5)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))
public static PRECISION QuintInOut(PRECISION x) => QuintInOut_Raw(x);

[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION QuintIn_Raw(PRECISION x) => x * x * x * x * x;
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION QuintOut_Raw(PRECISION x) => 1.0 - ((1.0 - x) * (1.0 - x) * (1.0 - x) * (1.0 - x) * (1.0 - x));
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION QuintInOut_Raw(PRECISION x) => x < 0.5 ? 16.0 * x * x * x * x * x : 1.0 - (((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * ((-2.0 * x) + 2.0) * 0.5);

/* Sine ================================================================ */
/// <summary>Sinusoidal easing (Entering).</summary>
public static PRECISION SineIn(PRECISION x) => SineIn_Raw(x);
/// <summary>Sinusoidal easing (Exiting).</summary>
public static PRECISION SineOut(PRECISION x) => SineOut_Raw(x);
/// <summary>Sinusoidal easing (Entering and Exiting).</summary>
public static PRECISION SineInOut(PRECISION x) => SineInOut_Raw(x);

[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION SineIn_Raw(PRECISION x) => 1.0 - Sin5((1.0 - x) * SYSMATH.PI * 0.5);
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION SineOut_Raw(PRECISION x) => Sin5(x * SYSMATH.PI * 0.5);
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION SineInOut_Raw(PRECISION x) => (1.0 - Sin5((0.5 - x) * SYSMATH.PI)) * 0.5;

// x5 faster but low quality especially for Elastic (in slo mo, less motion continuity)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -114,29 +132,31 @@ private static PRECISION Sin5(PRECISION t)
return t - (t * t * t * inv6) + (t * t * t * t * t * invC);
}

/// <summary>Sinusoidal easing (Entering).</summary>
public static PRECISION SineIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : 1.0 - Sin5((1.0 - x) * SYSMATH.PI * 0.5)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

/// <summary>Sinusoidal easing (Exiting).</summary>
public static PRECISION SineOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : Sin5(x * SYSMATH.PI * 0.5)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

/// <summary>Sinusoidal easing (Entering and Exiting).</summary>
public static PRECISION SineInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : (1.0 - Sin5((0.5 - x) * SYSMATH.PI)) * 0.5); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

/* Expo ================================================================ */

private const PRECISION ln_2 = 0.6931471805599453;

/// <summary>Exponential easing (Entering).</summary>
public static PRECISION ExpoIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : Math.exp(((10.0 * x) - 10.0) * ln_2)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION ExpoIn(PRECISION x) => ExpoIn_Raw(x);
/// <summary>Exponential easing (Exiting).</summary>
public static PRECISION ExpoOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : 1.0 - Math.exp((-10.0 * x) * ln_2)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION ExpoOut(PRECISION x) => ExpoOut_Raw(x);
/// <summary>Exponential easing (Entering and Exiting).</summary>
public static PRECISION ExpoInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? Math.exp(((20.0 * x) - 10.0) * ln_2) * 0.5 : (2.0 - Math.exp((10.0 - (20.0 * x)) * ln_2)) * 0.5); // (x == 0 ? 0 : (x == 1 ? 1 : ...))
public static PRECISION ExpoInOut(PRECISION x) => ExpoInOut_Raw(x);

[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION ExpoIn_Raw(PRECISION x) => x <= 0.0 ? 0.0 : Math.exp(((10.0 * x) - 10.0) * ln_2);
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION ExpoOut_Raw(PRECISION x) => x >= 1.0 ? 1.0 : 1.0 - Math.exp((-10.0 * x) * ln_2);
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION ExpoInOut_Raw(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? Math.exp(((20.0 * x) - 10.0) * ln_2) * 0.5 : (2.0 - Math.exp((10.0 - (20.0 * x)) * ln_2)) * 0.5);

private const PRECISION ln_2 = 0.6931471805599453;

/* Circ ================================================================ */
/// <summary>Circular easing (Entering).</summary>
public static PRECISION CircIn(PRECISION x) => CircIn_Raw(x);
/// <summary>Circular easing (Exiting).</summary>
public static PRECISION CircOut(PRECISION x) => CircOut_Raw(x);
/// <summary>Circular easing (Entering and Exiting).</summary>
public static PRECISION CircInOut(PRECISION x) => CircInOut_Raw(x);

[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION CircIn_Raw(PRECISION x) => 1.0 - FastSqrt(1.0 - (x * x));
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION CircOut_Raw(PRECISION x) => FastSqrt(1.0 - ((x - 1.0) * (x - 1.0)));
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION CircInOut_Raw(PRECISION x) => x < 0.5 ? (1.0 - FastSqrt(1.0 - ((2.0 * x) * (2.0 * x)))) * 0.5 : (FastSqrt(1.0 - ((2.0 - (2.0 * x)) * (2.0 - (2.0 * x)))) + 1.0) * 0.5;

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static PRECISION FastSqrt(PRECISION x)
Expand All @@ -155,44 +175,47 @@ private static PRECISION FastSqrt(PRECISION x)
return x <= 0.0 ? 0.0 : x * y;
}

/// <summary>Circular easing (Entering).</summary>
public static PRECISION CircIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : 1.0 - FastSqrt(1.0 - (x * x))); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

/// <summary>Circular easing (Exiting).</summary>
public static PRECISION CircOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : FastSqrt(1.0 - ((x - 1.0) * (x - 1.0)))); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

/// <summary>Circular easing (Entering and Exiting).</summary>
public static PRECISION CircInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? (1.0 - FastSqrt(1.0 - ((2.0 * x) * (2.0 * x)))) * 0.5 : (FastSqrt(1.0 - ((2.0 - (2.0 * x)) * (2.0 - (2.0 * x)))) + 1.0) * 0.5); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

/* Back ================================================================ */

private const PRECISION c1 = 1.70158;
private const PRECISION c2 = c1 * 1.525;

/// <summary>Back easing (overshooting) (Entering).</summary>
public static PRECISION BackIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : ((c1 + 1.0) * x * x * x) - (c1 * x * x)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION BackIn(PRECISION x) => BackIn_Raw(x);
/// <summary>Back easing (overshooting) (Exiting).</summary>
public static PRECISION BackOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : 1.0 + ((c1 + 1.0) * (x - 1.0) * (x - 1.0) * (x - 1.0)) + (c1 * (x - 1.0) * (x - 1.0))); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION BackOut(PRECISION x) => BackOut_Raw(x);
/// <summary>Back easing (overshooting) (Entering and Exiting).</summary>
public static PRECISION BackInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? ((2.0 * x) * (2.0 * x) * (((c2 + 1.0) * (2.0 * x)) - c2)) * 0.5 : (((2.0 * x - 2.0) * (2.0 * x - 2.0) * (((c2 + 1.0) * (2.0 * x - 2.0)) + c2)) + 2.0) * 0.5); // (x == 0 ? 0 : (x == 1 ? 1 : ...))
public static PRECISION BackInOut(PRECISION x) => BackInOut_Raw(x);

/* Elastic ================================================================ */
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION BackIn_Raw(PRECISION x) => ((c1 + 1.0) * x * x * x) - (c1 * x * x);
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION BackOut_Raw(PRECISION x) => 1.0 + ((c1 + 1.0) * (x - 1.0) * (x - 1.0) * (x - 1.0)) + (c1 * (x - 1.0) * (x - 1.0));
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION BackInOut_Raw(PRECISION x) => x < 0.5 ? ((2.0 * x) * (2.0 * x) * (((c2 + 1.0) * (2.0 * x)) - c2)) * 0.5 : (((2.0 * x - 2.0) * (2.0 * x - 2.0) * (((c2 + 1.0) * (2.0 * x - 2.0)) + c2)) + 2.0) * 0.5;

private const PRECISION e_c4 = 2.0 * SYSMATH.PI / 3.0;
private const PRECISION e_c5 = 2.0 * SYSMATH.PI / 4.5;
private const PRECISION c1 = 1.70158;
private const PRECISION c2 = c1 * 1.525;

/* Elastic ================================================================ */
/// <summary>Elastic easing (oscillating spring) (Entering).</summary>
public static PRECISION ElasticIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : -Math.exp(((10.0 * x) - 10.0) * ln_2) * Math.sin(((10.0 * x) - 10.75) * e_c4)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION ElasticIn(PRECISION x) => ElasticIn_Raw(x);
/// <summary>Elastic easing (oscillating spring) (Exiting).</summary>
public static PRECISION ElasticOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : (Math.exp((-10.0 * x) * ln_2) * Math.sin(((10.0 * x) - 0.75) * e_c4)) + 1.0); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

public static PRECISION ElasticOut(PRECISION x) => ElasticOut_Raw(x);
/// <summary>Elastic easing (oscillating spring) (Entering and Exiting).</summary>
public static PRECISION ElasticInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? -Math.exp(((20.0 * x) - 10.0) * ln_2) * Math.sin(((20.0 * x) - 11.125) * e_c5) * 0.5 : (Math.exp((10.0 - (20.0 * x)) * ln_2) * Math.sin(((20.0 * x) - 11.125) * e_c5) * 0.5) + 1.0); // (x == 0 ? 0 : (x == 1 ? 1 : ...))
public static PRECISION ElasticInOut(PRECISION x) => ElasticInOut_Raw(x);

[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION ElasticIn_Raw(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : -Math.exp(((10.0 * x) - 10.0) * ln_2) * Math.sin(((10.0 * x) - 10.75) * e_c4));
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION ElasticOut_Raw(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : (Math.exp((-10.0 * x) * ln_2) * Math.sin(((10.0 * x) - 0.75) * e_c4)) + 1.0);
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION ElasticInOut_Raw(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? -Math.exp(((20.0 * x) - 10.0) * ln_2) * Math.sin(((20.0 * x) - 11.125) * e_c5) * 0.5 : (Math.exp((10.0 - (20.0 * x)) * ln_2) * Math.sin(((20.0 * x) - 11.125) * e_c5) * 0.5) + 1.0);

private const PRECISION e_c4 = 2.0 * SYSMATH.PI / 3.0;
private const PRECISION e_c5 = 2.0 * SYSMATH.PI / 4.5;

/* Bounce ================================================================ */
/// <summary>Bounce easing (simulated gravity/collision) (Entering).</summary>
public static PRECISION BounceIn(PRECISION x) => BounceIn_Raw(x);
/// <summary>Bounce easing (simulated gravity/collision) (Exiting).</summary>
public static PRECISION BounceOut(PRECISION x) => BounceOut_Raw(x);
/// <summary>Bounce easing (simulated gravity/collision) (Entering and Exiting).</summary>
public static PRECISION BounceInOut(PRECISION x) => BounceInOut_Raw(x);

[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION BounceIn_Raw(PRECISION x) => 1.0 - BounceOut_Impl(1.0 - x);
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION BounceOut_Raw(PRECISION x) => BounceOut_Impl(x);
[MethodImpl(MethodImplOptions.AggressiveInlining)] internal static PRECISION BounceInOut_Raw(PRECISION x) => x < 0.5 ? (1.0 - BounceOut_Impl(1.0 - (2.0 * x))) * 0.5 : (1.0 + BounceOut_Impl((2.0 * x) - 1.0)) * 0.5;

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static PRECISION BounceOut_Impl(PRECISION x)
Expand All @@ -204,14 +227,5 @@ private static PRECISION BounceOut_Impl(PRECISION x)
x < 2.5 * d1_inv ? (n1 * (x - (2.25 * d1_inv)) * (x - (2.25 * d1_inv))) + 0.9375 :
(n1 * (x - (2.625 * d1_inv)) * (x - (2.625 * d1_inv))) + 0.984375;
}

/// <summary>Bounce easing (simulated gravity/collision) (Entering).</summary>
public static PRECISION BounceIn(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : 1.0 - BounceOut_Impl(1.0 - x)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

/// <summary>Bounce easing (simulated gravity/collision) (Exiting).</summary>
public static PRECISION BounceOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : BounceOut_Impl(x)); // (x == 0 ? 0 : (x == 1 ? 1 : ...))

/// <summary>Bounce easing (simulated gravity/collision) (Entering and Exiting).</summary>
public static PRECISION BounceInOut(PRECISION x) => x <= 0.0 ? 0.0 : (x >= 1.0 ? 1.0 : x < 0.5 ? (1.0 - BounceOut_Impl(1.0 - (2.0 * x))) * 0.5 : (1.0 + BounceOut_Impl((2.0 * x) - 1.0)) * 0.5); // (x == 0 ? 0 : (x == 1 ? 1 : ...))
}
}
Loading