1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 17:26:03 +08:00
Daniele Giardini ea7a7a7cfd - Implemented support for long and ulong formats
- Fixed IsTweening returning TRUE if called inside a tween's OnComplete
2015-03-31 10:02:15 +02:00

46 lines
1.1 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using DG.Tweening;
public class UIMisc : BrainBase
{
public CanvasGroup cGroup;
public Image[] imgs;
public Text text, textScramble;
IEnumerator Start()
{
yield return new WaitForSeconds(0.5f);
// Radial
Sequence s = DOTween.Sequence();
foreach (Image i in imgs) {
Image img = i;
img.fillAmount = 0;
s.Insert(0, img.DOFillAmount(1, 1).SetEase(Ease.Linear))
.Join(img.DOFade(0, 1).From().SetEase(Ease.Linear))
.SetLoops(-1, LoopType.Yoyo);
}
s.OnStepComplete(()=> {
foreach (Image img in imgs) img.fillClockwise = !img.fillClockwise;
});
// Text
DOTween.Sequence()
.AppendInterval(0.5f)
.Append(text.DOText("", 2).From().SetEase(Ease.Linear))
.AppendInterval(0.5f)
.SetLoops(-1, LoopType.Yoyo);
DOTween.Sequence()
.AppendInterval(0.5f)
.Append(textScramble.DOText("", 2, true, ScrambleMode.Lowercase).From().SetEase(Ease.Linear))
.AppendInterval(0.5f)
.SetLoops(-1, LoopType.Yoyo);
}
void OnGUI()
{
if (GUILayout.Button("Fade CanvasGroup")) cGroup.DOFade(0, 1);
}
}