Page 1 of 1

source text and layers/pre-comps

Posted: February 16th, 2011, 11:37 am
by wyz
Hey guys!
Is there a way to make source text drive individual animated letter layers or pre-comps?
For instance, an "A" comp or layer would be displayed when source text from a text layer has an "A". Any thoughts?
Thanks!

Re: source text and layers/pre-comps

Posted: February 16th, 2011, 3:40 pm
by Dan Ebberts
Sure. Here's an opacity expression that would make a layer invisible unless the first character of the text in "My Text Layer" is "A":

txt = thisComp.layer("My Text Layer").text.sourceText;
txt[0] == "A" ? 100 : 0


Dan

Re: source text and layers/pre-comps

Posted: February 16th, 2011, 4:38 pm
by wyz
Dan thanks It works great!! I really admire the way you code, really clean and direct, i was trying to do something like this:

var a = "Super";
var myText = a;
if (a.substring(0).match("S")) {
myText = "Yes it maches";
(doStuff to layers here)
}