public static float Periodic(float A, float B, float period, float t, float PhaseDegree) { float Normalized = .5f - .5f * (float)Math.Cos(t * 2 * Math.PI / period + CoreMath.Radians(PhaseDegree)); return(A + (B - A) * Normalized); }