source text and layers/pre-comps

Moderators: Disciple, zlovatt

Post Reply
wyz
Posts: 3
Joined: May 23rd, 2005, 5:38 pm
Location: Barcelona, Spain

February 16th, 2011, 11:37 am

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!
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

February 16th, 2011, 3:40 pm

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
wyz
Posts: 3
Joined: May 23rd, 2005, 5:38 pm
Location: Barcelona, Spain

February 16th, 2011, 4:38 pm

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)
}
Post Reply