private void HandleStay() { //Increment elapsed time ElapsedTime += Time.ElapsedMilliseconds; //Go to the FadeOut state since we're done if (ElapsedTime >= IconStayTime) { IconElementState = IconElementStates.FadeOut; ElapsedTime = 0d; } }
private void HandleFadeOut() { Color startColor = OrigColor; Color endColor = OrigColor * 0f; //Increment elapsed time and lerp from a fully opaque color to a fully transparent color ElapsedTime += Time.ElapsedMilliseconds; TintColor = Color.Lerp(startColor, endColor, (float)(ElapsedTime / IconFadeTime)); //The icon element is completely done, so mark as finished if (ElapsedTime >= IconFadeTime) { TintColor = endColor; IconElementState = IconElementStates.Done; ElapsedTime = 0d; } }
private void HandleFadeIn() { Color startColor = OrigColor * 0f; Color endColor = OrigColor; //Increment elapsed time and lerp from a fully transparent color to a fully opaque color ElapsedTime += Time.ElapsedMilliseconds; TintColor = Color.Lerp(startColor, endColor, (float)(ElapsedTime / IconFadeTime)); //We're done, so go into the Stay state if (ElapsedTime >= IconFadeTime) { TintColor = endColor; IconElementState = IconElementStates.Stay; ElapsedTime = 0d; } }