private static IEnumerator ChangeScale(QuickPolygon shape, float endWidth, float endHeight, InterpolateType interpolateType, float duration) { float startW = shape.GetWidth(); float startH = shape.GetHeight(); float timeElapsed = 0; while (timeElapsed < duration) { float newW = GetInterpolate(interpolateType, startW, endWidth, timeElapsed, duration); float newH = GetInterpolate(interpolateType, startH, endHeight, timeElapsed, duration); shape.SetScale(newW, newH, true); yield return(new WaitForEndOfFrame()); timeElapsed += Time.deltaTime; } shape.SetScale(endWidth, endHeight, true); }