ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression Text Source Decomposed into layers

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Max Tischler
Expression Text Source Decomposed into layers
on May 30, 2017 at 11:25:19 pm

hello

I have a main text layer and want to link child text sources to the main text layer source.

this would be the expression:
comp("text_source").layer("TEXT1 TEXT2 TEXT3 Text4").text.sourceText


How can I display each word on its own per child layer. each word needs to be centred.
is there a way to copy the first word or second word etc. from the main source layer into the child source layer?
maybe with the index number?

(The animator=opacity solution is not working, as the word will not be centered and the anchor point will be at the wrong place.)

thanks


Return to posts index

Dan Ebberts
Re: Expression Text Source Decomposed into layers
on May 30, 2017 at 11:56:24 pm

As an example, this should give you the third word:

txt = comp("text_source").layer("TEXT1 TEXT2 TEXT3 Text4").text.sourceText;
txt.split(" ")[2]


Dan



Return to posts index

Max Tischler
Re: Expression Text Source Decomposed into layers
on May 31, 2017 at 1:23:45 am

yes. is working, thanks


Return to posts index


Max Tischler
Re: Expression Text Source Decomposed into layers
on May 31, 2017 at 3:15:45 pm

hello is it possible to have the pre-compname as the split number. (The pre-comp name would be a number)

like this

txt.split(" ")[pre-CompName]

how could i write this as an expression? thanks


Return to posts index

Dan Ebberts
Re: Expression Text Source Decomposed into layers
on May 31, 2017 at 3:58:18 pm

I haven't tried it, but like this maybe:

txt = comp("text_source").layer("TEXT1 TEXT2 TEXT3 Text4").text.sourceText;
idx = parseInt(thisComp.name,10)-1;
txt.split(" ")[idx]


Fan



Return to posts index

Max Tischler
Re: Expression Text Source Decomposed into layers
on May 31, 2017 at 5:33:02 pm

yes is working

( idx = parseInt(thisComp.name,10)-1; )
what is the 10 for ?

is it also possible to look up the layers comp number, and use the layers number as a split number?


Return to posts index


Dan Ebberts
Re: Expression Text Source Decomposed into layers
on May 31, 2017 at 6:15:05 pm

>is it also possible to look up the layers comp number

I'm not sure what you mean.

Dan



Return to posts index

Max Tischler
Re: Expression Text Source Decomposed into layers
on May 31, 2017 at 6:30:58 pm

txt = comp("text_source").layer("TEXT1 TEXT2 TEXT3 Text4").text.sourceText;
txt.split(" ")[3]

instead of 3, the expression uses the number of the text layer inside the composition.

for example
layer 1 = text (the expression looks up this number, which is 1 in this case)
layer 2 = background


Return to posts index

Dan Ebberts
Re: Expression Text Source Decomposed into layers
on May 31, 2017 at 6:42:31 pm

probably like this:

txt.split(" ")[index-1]


Dan



Return to posts index


Max Tischler
Re: Expression Text Source Decomposed into layers
on May 31, 2017 at 8:02:02 pm

yes is working. what is a good source for learning expression. how do you know all this?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]