/// <summary> /// Directly change the text. Complete with fading in and out. /// </summary> /// <param name="text">The string to display in the UI</param> public void SetText(string text) { ResetSequence() .AppendCallback(() => textUI.text = text) .Append(textUI.DOFade(1, fadeInTime)) .OnKill(() => currentSequence = null); //Clear the in-class ref so we don't throw logs in console }
void Toggle(bool enabled) { if (enabled) { text.DOFade(1f, 0.05f).SetEase(Ease.InCubic); } else { text.DOFade(0f, 0.5f).SetEase(Ease.OutSine); } }
public void StartFade(bool withRandomStartOffset, FadeType fadeType) { AnimationCfg animCfg = Root.Instance.ConfigManager.Animation; if (withRandomStartOffset) { Vector2 randomUnitCircle = UnityEngine.Random.insideUnitCircle.normalized * animCfg.textFloatRandomOffsetRadius; rectTransform.localPosition += new Vector3(randomUnitCircle.x, randomUnitCircle.y, 0); } textLabel.DOFade(0, animCfg.textChangeFloatDuration); switch (fadeType) { case FadeType.MoveUp: float targetY = rectTransform.localPosition.y + animCfg.textChangeFloatOffsetY; rectTransform.DOLocalMoveY(targetY, animCfg.textChangeFloatDuration).SetEase(animCfg.textChangeFloatEase) .OnComplete(() => OnFadeCompleted()); break; case FadeType.ZoomIn: float targetScale = rectTransform.localScale.x * animCfg.textChangeZoomInScale; rectTransform.DOScale(targetScale, animCfg.textChangeFloatDuration).SetEase(animCfg.textChangeFloatEase) .OnComplete(() => OnFadeCompleted()); break; default: Debug.LogError($"Unknown fade type {fadeType}"); break; } }
private void Start() { m_textMesh.DOFade(0f, duration / 2f).SetDelay(duration / 2); var targetY = transform.localPosition.y + offsetY; transform.DOLocalMoveY(targetY, duration).SetEase(Ease.OutQuart).OnComplete(() => Destroy(gameObject)); }
public void ActivateFeedback() { // Default var DefaultScale = TextObject.rectTransform.localScale; DefaultScale.y = 0; TextObject.rectTransform.localScale = DefaultScale; TextObject.alpha = 1; // BAM! In! TextObject.rectTransform.DOScaleY(1, 0.2f); TextObject.DOFade(1.0f, 0.2f); TextObject.rectTransform.DOShakeRotation(0.4f, 40, 5); // Slow fade out DeactivateFeedback(); }
IEnumerator CoStart() { _intro_parent.SetActive(true); _teamNameLabel.color = new Color(1f, 1f, 1f, 0f); _char.color = new Color(1f, 1f, 1f, 0f); _char2.color = new Color(1f, 1f, 1f, 0f); _mates.color = new Color(1f, 1f, 1f, 0f); _bg.transform.localPosition = new Vector3(996f, 0f, 0f); _bgsprite.color = new Color(1f, 1f, 1f, 0f); yield return(new WaitForSeconds(0.4f)); yield return(_mates.DOFade(1f, 1.2f).WaitForCompletion(false)); yield return(new WaitForSeconds(1f)); yield return(_mates.DOFade(0f, 0.4f).WaitForCompletion(false)); yield return(_teamNameLabel.DOFade(1f, 0.3f).WaitForCompletion(false)); yield return(new WaitForSeconds(1.2f)); yield return(_teamNameLabel.DOFade(0f, 0.7f).WaitForCompletion(false)); _titleLable.color = new Color(1f, 1f, 1f, 0f); _title_parent.SetActive(true); _intro_parent.SetActive(false); yield return(_titleLable.DOFade(1f, 1f).WaitForCompletion(false)); yield return(_char.DOFade(1f, 0.8f).WaitForCompletion(false)); yield return(_char2.DOFade(1f, 0.4f).WaitForCompletion(false)); yield return(_titleLable.DOColor(new Color(0.9f, 0.4f, 0.4f), 1f).WaitForCompletion(false)); _bgsprite.DOFade(1f, 0.4f).WaitForCompletion(false); _bg.DOMove(new Vector3(-4548f, 0f, 0f), 100f); _pressButton.SetActive(true); _pressButtonLable.DOFade(1f, 1f).CompletedLoops(); _isUpdateCheck = true; CurState = State.Title; yield break; }
public void AddNewSecret() { secretsText.DOFade(1, 0.3f); index++; secretsText.text = index.ToString() + "/" + numberOfSecrets.ToString(); }