1
DOTween & DOTween Pro / Re: Tweens in Sequences: A quick pointer in the right direction!
« on: November 13, 2015, 05:44:51 PM »
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:
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!
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!