Animate text by single character
by Antons Piskins on Sep 9, 2015 at 8:15:20 pm
Is there any good way to animate text so it just shows just one character at time and changes to next character after certain time? Can not find any text effect that could do that and doing it manually would take quite a lot time. Thanks in advance!
Re: Animate text by single character by Walter Soyka on Sep 10, 2015 at 12:17:11 pm
Add a Slider Control effect to your text layer and name it "textIndex". You'll be able to animate this slider to control which single character of all the text entered into the text layer is shown.
Twirl open the text layer in the timeline, then twirl open its Text property. Alt+click the Source Text stopwatch and enter the following expression:
// use a control to govern which character we show
// subtract 1 from that value for natural indexing (first character = 1) instead of zero-origin indexing (first character = 0)
// if you want zero-origin indexing, remove the "- 1" below.
textIndex = Math.floor(effect("textIndex")("Slider")) - 1;
// make sure we don't go out of bounds; index must be no smaller than 0 and no larger than the length of the text
// if we are out of bounds, show no character
if ((textIndex < 0) || (textIndex > value.length)) '' else value.substr(textIndex,1);
I've commented it to try to make it clearer what's going on, but ask questions if you need to.