Beispiel #1
0
    public static IEnumerator ChangeSliderValueUsingEaseIn(ImageSlider imageSlider, float endValue, float duration)
    {
        float ElapsedTime = 0;
        float startValue  = imageSlider.FillAmount;

        while (ElapsedTime <= duration)
        {
            imageSlider.FillAmount = ImageSlider.Lerp(startValue, endValue, EaseIn(ElapsedTime / duration));
            yield return(null);

            ElapsedTime += Time.deltaTime;
        }
    }
Beispiel #2
0
    IEnumerator lerpVolumeLevels(AudioSource audioSource, float endValue, float duration)
    {
        float ElapsedTime = 0;
        float startValue  = audioSource.volume;

        while (ElapsedTime <= duration)
        {
            audioSource.volume = ImageSlider.Lerp(startValue, endValue, ImageSlider.EaseOut(ElapsedTime / duration));
            yield return(null);

            ElapsedTime += Time.unscaledDeltaTime;
        }
    }