Demigiant Forum

Unity Assets => DOTween & DOTween Pro => Topic started by: Thenamelessone on September 10, 2015, 09:33:35 PM

Title: Text Animation Direction
Post by: Thenamelessone on September 10, 2015, 09:33:35 PM
I have two tweens.

One animates text in and another animates the text out.

I am trying to go with the top effect: (http://dotween.demigiant.com/_imgs/content/dotween_dotext.gif)

However, there is no option for tween direction? It will always animate the same direction: from the left.

How is this example done?

Thanks!
Title: Re: Text Animation Direction
Post by: Daniele on September 10, 2015, 11:44:08 PM
Hi,

I am not sure what you mean with "animate from left". If you mean you'd want the tween to start from the filled string and "clear" it, you can just pass a value of "" to the end value.

About that example, you can find a similar one in the examples package (http://dotween.demigiant.com/examples.php).

Cheers,
Daniele
Title: Re: Text Animation Direction
Post by: Thenamelessone on September 11, 2015, 05:07:33 AM
The examples in the package don't help :(

What I mean is this:

Print Hello starting from the left to the right.

->
H e l l o

Now take away each letter backwards;

hello
hell
hel
he
h
(nothing)

Just like the first tween in that gif.

Thanks!
Title: Re: Text Animation Direction
Post by: Daniele on September 11, 2015, 11:48:43 AM
That GIF simply uses a Yoyo loop, so that the tween plays forward and then backwards automatically:
Code: [Select]
myText.DOText("Final message to display", 2).SetLoops(-1, LoopType.Yoyo);
Otherwise, you could actually control it, like this:
Code: [Select]
// Set autokill to false so the tween is reusable
myTween = myText.DOText("Final message to display", 2).SetLoops(-1, LoopType.Yoyo).SetAutoKill(false);
// ... somewhere else in your code ...
// Plays the animation forward
myTween.PlayForward();
// Plays the animation backwards, cancelling the letters
myTween.PlayBackwards();