Ejemplo n.º 1
0
    void BubblyText(int start, int end, bool scaleFade)
    {
        var sequence = DOTween.Sequence();

        for (var i = start; i <= end; ++i)
        {
            var timeOffset   = Mathf.Lerp(0, 1, (i - start) / (float)(end - start + 1));
            var charSequence = DOTween.Sequence();
            if (scaleFade)
            {
                charSequence.Append(tweener.DOLocalMoveY(i, valueY, duration).SetEase(Ease.InOutCubic))
                //.Join(tweener.DOFade(i, 1.0f, 0.5f).From())
                .Join(tweener.DOScale(i, 0, 0.5f).From().SetEase(Ease.OutBack, 5))
                .Append(tweener.DOLocalMoveY(i, 0, duration).SetEase(Ease.OutBounce));
            }
            else
            {
                charSequence.Append(tweener.DOLocalMoveY(i, valueY, duration).SetEase(Ease.InOutCubic))
                //.Join(tweener.DOFade(i, 1.0f, 0.5f).From())
                //.Join(tweener.DOScale(i, 0, 0.5f).From().SetEase(Ease.OutBack, 5))
                .Append(tweener.DOLocalMoveY(i, 0, duration).SetEase(Ease.OutBounce));
            }

            sequence.Insert(timeOffset, charSequence);
        }

        sequence.SetLoops(-1, LoopType.Yoyo);
    }
Ejemplo n.º 2
0
    // Char tween: bubbly fade-in + bounce
    private void TweenBubble(int start, int end, float duration, float scale, Action onComplete)
    {
        var sequence = DOTween.Sequence();

        for (var i = start; i < end; ++i)
        {
            var timeOffset   = Mathf.Lerp(0, duration, (i - start) / (float)(end - start + duration));
            var charSequence = DOTween.Sequence();
            charSequence.Append(_tweener.DOLocalMoveY(i, 0.5f, duration).SetEase(Ease.InOutCubic))
            .Join(_tweener.DOFade(i, 0, duration).From())
            .Join(_tweener.DOScale(i, 0, duration).From().SetEase(Ease.OutBack, scale))
            .Append(_tweener.DOLocalMoveY(i, 0, duration).SetEase(Ease.OutBounce));
            sequence.Insert(timeOffset, charSequence);
        }
        sequence.Play().AppendCallback(() => onComplete());
    }
Ejemplo n.º 3
0
        // Sequence example, bubbly fade-in + bounce
        private void Tween3(int start, int end)
        {
            var sequence = DOTween.Sequence();

            for (var i = start; i <= end; ++i)
            {
                var timeOffset   = Mathf.Lerp(0, 1, (i - start) / (float)(end - start + 1));
                var charSequence = DOTween.Sequence();
                charSequence.Append(_tweener.DOLocalMoveY(i, height, 0.5f).SetEase(Ease.InOutCubic))
                .Join(_tweener.DOFade(i, 0, 0.5f).From())
                .Join(_tweener.DOScale(i, 0, 0.5f).From().SetEase(Ease.OutBack, 5))
                .Append(_tweener.DOLocalMoveY(i, 0, 0.5f).SetEase(Ease.OutBounce));
                sequence.Insert(timeOffset, charSequence);
            }

            sequence.SetLoops(-1, LoopType.Yoyo);
        }
Ejemplo n.º 4
0
        private void PrepareTween(Playable playable)
        {
            var duration = (float)playable.GetDuration();
            var charAnimationDuration = duration * (1 + overlap) / charTweener.CharacterCount;
            var charStartOffset       = charAnimationDuration * (1 - overlap);

            sequence = DOTween.Sequence();
            sequence.AppendCallback(() => sequence = null);

            for (var i = 0; i < charTweener.CharacterCount; ++i)
            {
                var timeOffset = charStartOffset * i;

                var stepDuration = charAnimationDuration / 4;

                var charSequence = DOTween.Sequence();
                charSequence.Append(charTweener.DOLocalMoveY(i, 0.5f, stepDuration).SetEase(Ease.InOutCubic))
                .Join(charTweener.DOFade(i, 0, stepDuration).From())
                .Join(charTweener.DOScale(i, 0, stepDuration).From().SetEase(Ease.OutBack, 5))
                .Append(charTweener.DOLocalMoveY(i, 0, stepDuration).SetEase(Ease.OutBounce));
                sequence.Insert(timeOffset, charSequence);
            }
        }