ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Combining text.sourceText.split with SourceRectAtTime

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Niels B Nielsen
Combining text.sourceText.split with SourceRectAtTime
on Dec 5, 2017 at 11:12:03 pm
Last Edited By Niels B Nielsen on Dec 5, 2017 at 11:14:52 pm

I'm working on a Premiere live text template with dynamic links to After Effects graphics. I'm using text.sourceText.split expression in a text animator to highlight certain words. I would like the highlighted words to be in a box. Is it possible to somehow combine the text.sourceText.split expression with a SourceRectAtTime expression for only the selected words?

The text.sourceText.split expression used is:

highlight = thisComp.layer("[HIGHLIGHT WORDS]").text.sourceText.split("+");

result = 100;

for (i = 0; i < highlight.length; i++){

if (textIndex == parseInt(highlight[i],10)){

result = 0;





This is great for coloring words, but can I somehow make these words appear in a box? I've tried creating a boxed font variant and put this in a layer below, but I guess theres a better/simpler way to achieve this?

Return to posts index

Kalleheikki Kannisto
Re: Combining text.sourceText.split with SourceRectAtTime
on Dec 17, 2017 at 3:04:19 pm

If it is always one continuous range that you want to highlight, you might want to break the text onto three layers (in most cases the word to be marked would be in middle of the string), then you can use sourcerect to move the layers in the right locations one after the other and then draw a box around the middle box.

Also, there will be situations where the word(s) are in the first or last rectangle, so some IF statements are needed to draw around the first or last box. In which case you would really be using just two of the layers.

Kalleheikki Kannisto
Senior Graphic Designer

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved