/// <summary> /// Simple cosinuosidal animation during transitioning to new target /// </summary> private void NoddingCalculations() { if (nodProgress < nodDuration) { if (nodProgress < nodDuration) { nodProgress += delta; } else { nodProgress = nodDuration; } float progress = nodProgress / nodDuration; progress = FEasing.EaseOutCubic(0f, 1f, progress); if (progress >= 1f) { nodValue = 0f; } else { nodValue = Mathf.Sin(progress * (Mathf.PI)); } } }
/// <summary> /// Computing elastic clamp angle for given parameters /// </summary> private float GetClampedAngle(float current, float limit, float elastic, float sign = 1f) { if (elastic <= 0f) { return(limit); } else { float elasticRange = 0f; if (elastic > 0f) { elasticRange = FEasing.EaseOutCubic(0f, elastic, (current * sign - limit * sign) / (180f + limit * sign)); } return(limit + elasticRange * sign); } }