• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can sourceRectAtTime be used for a single word in a text string?

Valorous Hero ,
Jul 29, 2019 Jul 29, 2019

Copy link to clipboard

Copied

I'd like to isolate a single word or a few words, to obtain their sourceRectAtTime props. The result should not interfere with their original position(s).

Possible with sourceRectAtTime or is there a better/alternative solution?

Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits
TOPICS
Expressions

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jul 29, 2019 Jul 29, 2019

Copy link to clipboard

Copied

As far as I know, sourceRectAtTime only gives the whole containing text, it's not an array of sub-sourceRects.

But you can create your text with several text layers.

All those text parts can be "sicked together" using sourceRectAtTime, as well: every word calculates its position in dependence of the previous one. The first word is the only one which can be freely moved.

Pseudocode would look like:

prevpos = layer(index-1).transform.position;

prevrect = layer(index-1)... sourceRectAtTime();

myposition = prevpos + prevrect;

If you give us more details on what you want to achieve, there will be another way, for sure.

*Martin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 30, 2019 Jul 30, 2019

Copy link to clipboard

Copied

Thanks for the reply Martin. I'm looking for a way to create a textbox for a single word or two or three words in a sentence/paragraph. IOW, I don't need the textbox for the entire sentence/paragraph.

Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jul 30, 2019 Jul 30, 2019

Copy link to clipboard

Copied

If I understand correctly, you want to put a rectangle around a single word (or some more) and an along going paragraph.

Despite several text layers, the fastest solution I can think of is a shape layer, or any variations of this (like controlling the shape position and length with nulls).

Maybe the text animation selector brings some luck, where you link it's percentage values to world coordinates, which you can use by the shape layer for positioning and length.

If the words before and after the textbox are always the same and only the textbox-ones are changing, you can check sourceRectAtTime without your keyword - keep the value in mind and subtract this from the actual sentence with the keyword in it. This gives you the length of the word which should get the textbox. Position is the same in all cases.

But yeah, this is only a way for this very special situation.

Cheers,

Martin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 13, 2019 Sep 13, 2019

Copy link to clipboard

Copied

The first solution that comes to mind to do this on a single text layer is to add some sliders to modify the position and size of the text box created by sourceRecAtTime. That could give you some control in Premiere Pro if you are building a MOGRT. I don't know of any way to do this automatically using a single text layer. 

 

On the other hand, there may be a way for sourceRecAtTime to be modified by the value of range selectors in a text animator. I'd have to play with that for a while.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

Hey Roland, did you ever find a workable solution for this? I'm up against the same challenge. Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

Eureka! I just solved it! Hit me up if anyone is interested.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

Can you share your solution, please?

*Martin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

I'm still working the kinks out, so bare with me.

 

The idea is to duplicate the original text, and hide it (link the sourceText of both layers). Then apply a scale animator, with the range selector's "Units" on "Index" and "Based On" on "Words". Try and find the selected word with range selector (there's an expression method for this, I've to still figure this out). Calculate the sourcerectAtTime of this hidden layer and you should end up with the size of the word in range.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

Duplicating the text in a layer to work in is exactly what I would propose.

Some tips:

- Make the Text Layer a Guide Layer instead of hiding it: this way you can see what you are doing but a Guide layer won't be rendered or displayed when nested into another comp.

- Why not just use the specific word you are looking for in the Guide Text Layer and get its sourceRect?

- An expression on the sourceText using indexOf() and substring() will propably be usefull for finding and selecting specific words in your text

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

LATEST

I know this method is possible but it's clunky and its adds a lot of Text Animators quickly,  especially when there are options for the user to select other Text Animation and Alignment options. Also, you don't need to convert the text layer to a guide layer - simply setting Transform>Optacity to 0 will suffice.

 

I was hoping for a text.sourceText expression, probably with Regex but the more I think of it, the less like it's a probable solution since this route will affect the position of any targetted word in the original text string.

Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines