public bool CalculateScaleValueMatrix(float fromValue, float toValue, float offsetValue, float pivotValue, out Matrix4x4 transform, out bool flipKeys)
{
transform = Matrix4x4.identity;
flipKeys = false;
float num = 0.001f;
float f = toValue - pivotValue;
float num3 = fromValue - pivotValue;
if ((Mathf.Abs(f) - offsetValue) < 0f)
{
return false;
}
f = (Mathf.Sign(f) != Mathf.Sign(num3)) ? (f + offsetValue) : (f - offsetValue);
if (Mathf.Approximately(num3, 0f))
{
transform.SetTRS(new Vector3(0f, f, 0f), Quaternion.identity, Vector3.one);
flipKeys = false;
return true;
}
if (Mathf.Abs(f) < num)
{
f = (f >= 0f) ? num : -num;
}
float y = f / num3;
transform.SetTRS(new Vector3(0f, pivotValue, 0f), Quaternion.identity, Vector3.one);
transform *= Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1f, y, 1f));
transform *= Matrix4x4.TRS(new Vector3(0f, -pivotValue, 0f), Quaternion.identity, Vector3.one);
flipKeys = y < 0f;
return true;
}