private void Update() { if (useAnimations) { progress.fillAmount = VelocityLerp.LerpWithVelocity(progress.fillAmount, targetVal, ref currentVelocity, Time.deltaTime * fadeSpeed); } }
private void OnEnable() { this.ExecuteRepeated(delegate { var currentAlpha = GetCanvasGroup().alpha; if (currentAlpha != targetAlpha) { var newAlpha = VelocityLerp.LerpWithVelocity(currentAlpha, targetAlpha, ref currentVelocity, Time.deltaTime * fadeSpeed); canvasGroup.alpha = newAlpha; } return(true); }, delayInMsBetweenIterations); }
private void OnEnable() { initialAlpha = GetComponent <CanvasGroup>().alpha; targetAlpha = initialAlpha; this.ExecuteRepeated(delegate { if (canvasGroup == null) { canvasGroup = GetComponent <CanvasGroup>(); } var a = canvasGroup.alpha; if (a != targetAlpha) { canvasGroup.alpha = VelocityLerp.LerpWithVelocity(a, targetAlpha, ref currentVelocity, Time.deltaTime * fadeSpeed); } return(true); }, delayInMsBetweenIterations); }