public bool CalculateScaleTimeMatrix(float fromTime, float toTime, float offsetTime, float pivotTime, float frameRate, out Matrix4x4 transform, out bool flipKeys)
{
transform = Matrix4x4.identity;
flipKeys = false;
float num = !Mathf.Approximately(frameRate, 0f) ? (1f / frameRate) : 0.001f;
float f = toTime - pivotTime;
float num3 = fromTime - pivotTime;
if ((Mathf.Abs(f) - offsetTime) < 0f)
{
return false;
}
f = (Mathf.Sign(f) != Mathf.Sign(num3)) ? (f + offsetTime) : (f - offsetTime);
if (Mathf.Approximately(num3, 0f))
{
transform.SetTRS(new Vector3(f, 0f, 0f), Quaternion.identity, Vector3.one);
flipKeys = false;
return true;
}
if (Mathf.Abs(f) < num)
{
f = (f >= 0f) ? num : -num;
}
float x = f / num3;
transform.SetTRS(new Vector3(pivotTime, 0f, 0f), Quaternion.identity, Vector3.one);
transform *= Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(x, 1f, 1f));
transform *= Matrix4x4.TRS(new Vector3(-pivotTime, 0f), Quaternion.identity, Vector3.one);
flipKeys = x < 0f;
return true;
}