示例#1
0
    private IEnumerator ChangeBackgroundCoroutine()
    {
        var targetColor1 = ColorHelper.ShiftColor(_currentColor1, _colorIncrement);
        var targetColor2 = _currentColor1;

        while (!ColorHelper.AreSimilar(_currentColor1, targetColor1))
        {
            _currentColor1 = Color.Lerp(_currentColor1, targetColor1, Time.deltaTime * _lerpSpeed);
            _currentColor2 = Color.Lerp(_currentColor2, targetColor2, Time.deltaTime * _lerpSpeed);

            _gradientShader.SetColor(COLOR_ONE, _currentColor1);
            _gradientShader.SetColor(COLOR_TWO, _currentColor2);

            yield return(null);
        }
    }