internal static IEnumerator AnimateTrackCoroutine(PointDefinition points, Property property, float duration, float startTime, Functions easing) { while (true) { float elapsedTime = Instance.CustomEventCallbackController._audioTimeSource.songTime - startTime; float time = Easings.Interpolate(Mathf.Min(elapsedTime / duration, 1f), easing); switch (property.PropertyType) { case PropertyType.Linear: property.Value = points.InterpolateLinear(time); break; case PropertyType.Vector3: property.Value = points.Interpolate(time); break; case PropertyType.Vector4: property.Value = points.InterpolateVector4(time); break; case PropertyType.Quaternion: property.Value = points.InterpolateQuaternion(time); break; } if (elapsedTime < duration) { yield return(null); } else { break; } } }
internal Vector4?InterpolateVector4(float time) { if (_basePointData == null) { return(null); } if (_previousPointData == null) { return(_basePointData.InterpolateVector4(time)); } return(Vector4.LerpUnclamped(_previousPointData.InterpolateVector4(time), _basePointData.InterpolateVector4(time), Time)); }