Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Maisey

Pages: [1]
1
It's super! Great work :)

What you see there is pretty much all there is, so I am not using the Sequence multiple times.

Here is the complete code:

Code: [Select]
using UnityEngine;
using System.Collections;
using DG.Tweening;
using UnityEngine.UI;


public class TweenScript : MonoBehaviour {

    RectTransform rectTrans = null;

    void Start()
    {
        DOTween.Init();
        rectTrans = GetComponent<RectTransform>();
        PlayTween();
    }

    Sequence mySequence = DOTween.Sequence();

     Tween anchorMinTween = null;
     Tween anchorMaxTween = null;
     Tween anchorPositionTween = null;
     Tween scaleTween = null;

    void PlayTween()
    {       
        anchorMaxTween = DOTween.To(() => rectTrans.anchorMax, v => rectTrans.anchorMax = v, new Vector2(0.5f,0.5f), 1f)
           // .Pause()
           .SetDelay(2f)
            ;

        anchorMinTween = DOTween.To(() => rectTrans.anchorMin, v => rectTrans.anchorMin = v, new Vector2(0.5f, 0.5f), 1f)
           // .Pause()
           .SetDelay(2f)
            ;

        anchorPositionTween = DOTween.To(() => rectTrans.anchoredPosition, v => rectTrans.anchoredPosition = v, Vector2.zero, 1f)
            //.Pause()
            .SetDelay(2f)
            ;

        scaleTween = DOTween.To(() => rectTrans.localScale, v => rectTrans.localScale = v, Vector3.zero, 1f)
            //.Pause()
            .SetDelay(2f)
            ;

        mySequence
            .AppendInterval(5f)
            .Append(anchorMaxTween)
            .Join(anchorMinTween)
            .Join(anchorPositionTween)
            .AppendInterval(2f)
            .Append(scaleTween)
            //.SetDelay(2f)
            //.Play()
            .Pause()
            ;
    }
}

I am using the latest version 1.1.0.60 of DOTween. I couldn't attach a zip of the example project (too large), but to replicate just drag the above code to a Raw Image object with a UI Canvas Parent.

Where do you think I might be doing things wrong?

Thanks!

2
Hello and thanks for making this awesome tool so awesome! :)

I have been using DOTween alot but have run into some problems wrapping my head around how to use and control tweens in sequences.

I want to be able to define tweens and then insert them into a Sequence to manage them all at once using .Kill() / .Pause() / etc on the sequence rather than having to do that on every tween. Not being a very good programmer I need to trial and error myself forward and sometimes it works sometimes it don't, - my problem is I don't know why?

So if someone could enlighten me why, for example, is the below code not performing as 'intended' (and instead ignoring the AppendIntervals & Not Pausing)?

Code: [Select]
     Sequence mySequence = DOTween.Sequence();

     Tween anchorMinTween = null;
     Tween anchorMaxTween = null;
     Tween anchorPositionTween = null;
     Tween scaleTween = null;

    void PlayTween()
    {       
        anchorMaxTween = DOTween.To(() => rectTrans.anchorMax, v => rectTrans.anchorMax = v, new Vector2(0.5f,0.5f), 1f)
           // .Pause()
           .SetDelay(2f)
            ;

        anchorMinTween = DOTween.To(() => rectTrans.anchorMin, v => rectTrans.anchorMin = v, new Vector2(0.5f, 0.5f), 1f)
           // .Pause()
           .SetDelay(2f)
            ;

        anchorPositionTween = DOTween.To(() => rectTrans.anchoredPosition, v => rectTrans.anchoredPosition = v, Vector2.zero, 1f)
            //.Pause()
            .SetDelay(2f)
            ;

        scaleTween = DOTween.To(() => rectTrans.localScale, v => rectTrans.localScale = v, Vector3.zero, 1f)
            //.Pause()
            .SetDelay(2f)
            ;

        mySequence
            .AppendInterval(5f)
            .Append(anchorMaxTween)
            .Join(anchorMinTween)
            .Join(anchorPositionTween)
            .AppendInterval(2f)
            .Append(scaleTween)
            //.SetDelay(2f)
            //.Play()
            .Pause()
            ;
    }
}

I'm probably missing something fundamental, but I have been looking to find a solution to what's wrong in my thinking for days and feel I need some pro directions :)

Thanks again!

Cheers!!

Pages: [1]