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?
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.
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.
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.
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.
Hey Roland, did you ever find a workable solution for this? I'm up against the same challenge. Thanks
Eureka! I just solved it! Hit me up if anyone is interested.
Can you share your solution, please?
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.
Duplicating the text in a layer to work in is exactly what I would propose.
- 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
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.