Discussion:
question about making adjustments to a text animation preset
(too old to reply)
T***@adobeforums.com
2006-12-17 22:05:01 UTC
Permalink
Since this may involve expressions, I am posting my question here as well is in the general discussion forum:

I am currently using the "Word Processor" preset that I will want to use for many, MANY title sequences I will be generating. I have some questions about how I can better customize it so as to really help me with my workflow. I spent some time analyzing the settings after I applied the animation preset, and I'm starting to understand some of it (I think), but I want to do something further, and I'm not sure if I can.

There is a "Slider Control" (an expression control effect) named "Type-On" that is used by the various expressions that drive this animation preset. I have determined that the slider value controls the "Offset (By Index)" values that reveal the source text as well as animate the "cursor" character. By adding one more character to my source text string than necessary, I can set the end keyframe for the Type-On property to the length of my text string minus one. That way the cursor remains and blinks after typing the desired text string as seen in the Gallery of text animation presets. My question is:

• Can the end keyframe value for the Type-On slider somehow be automated/driven (through an expression?) so that it will always be the length of the text string minus one?

I will be doing so many of these text animations that it would be worth the effort to automate this process as much as possible at the beginning. I know I can manually go in and change the value of the end keyframe after counting how many characters are in any given text string. But it sure would be cool if I could just pull the length of the text string from the source text automatically and pass that to the slider property somehow.

Thanks in advance for any suggestions!
A***@adobeforums.com
2006-12-17 23:30:42 UTC
Permalink
I haven't tested this thoroughly, but give this expression a try on the slider:

linear(value, key(1).value, key(2).value, key(1).value, text.sourceText.length-1)
d***@adobeforums.com
2006-12-18 05:50:48 UTC
Permalink
Hi

the expression works but only for one text line,mmmmhhh.
It works the same way if you only add this code >text.sourceText.length-1
T***@adobeforums.com
2006-12-18 14:57:27 UTC
Permalink
Thank you very much for the answer. Much appreciated!

If you have the time, would you mind explaining in lay terms what each portion of the given expression is doing? I understand the expression conceptually, but I think I would be challenged to extrapolate the logic used here to create my own expression using this method. The idea of controlling keyframes through expressions makes sense to me on the one hand, but typically expressions control the value of a property on a per-frame basis without keyframes, so I'm having trouble making the jump to fully comprehend how your expression achieves the end result. I think I'm getting thrown mainly because I am able to set the first keyframe to zero manually, but the second keyframe is determined by the expression. Maybe just a "talk through" of what each argument in the expression is doing given a particular text string, if you have a moment? For example, let's say the text string I'm using has a length of 12. I have created two keyframes for the "Type-on" slider property. Keyframe #1 has a value of zero at time 2:00 and keyframe #2 is to be set by the expression and it resides at time 4:12.

Thanks again!
A***@adobeforums.com
2006-12-19 05:34:37 UTC
Permalink
The reason my code doesn't work for more than one line is that AE doesn't count a carriage return as a character for the purposes of indexing the characters in a text layer, while the string object does. So an expression that counts the number of carriage returns (and other such characters) is needed.
A***@adobeforums.com
2006-12-19 16:43:24 UTC
Permalink
Okay, this should work for multi-line text:

function countChars(ch)
{
sub = text.sourceText;
numChars = -1;

for (i = 0; (i > -1) && numChars < 100; numChars++)

{
sub = sub.substring(i+1, sub.length);
i = sub.indexOf(ch);

}

return numChars;
}

extraChars = countChars("\r");

linear(value, key(1).value, key(2).value, key(1).value, text.sourceText.length-1-extraChars);

Sorry about the wierd formatting. This forum isn't especially friendly to indentations and such.

I made the counting bit a function (countChars()) so that, if any other special characters end up throwing off the index count, all you have to do is add in an extra call to countChars().
d***@adobeforums.com
2006-12-21 10:26:49 UTC
Permalink
Hi
thanks for this code Aaron
T***@adobeforums.com
2006-12-21 20:26:28 UTC
Permalink
Awesome, Aaron. Thank you very much!

As long as this thread is getting bumped back up, I'm curious if anyone can help me figure out how to rewire the "Word Processor" text animation preset in order to get it to work from right to left. I want the cursor character to "lead" the text line, but that would mean the cursor would need to appear to the left of the text string as it appears from right to left. I'm trying to figure this out myself, but I don't know enough about the text animation "selectors" and "properties" to know how to change it correctly. There seem to be too many variables, and I'm ending up with all sorts of wacky stuff. I have some things correct, but I definitely need help from someone who has a better grasp of this.

Thanks. :-)

Loading...