Dynamically changing a stroke's range selector start/end point
-
Hi - so I recently got a great recommendation from @Jeff on creating a faux bold effect for a particular sentence within a paragraph of text imported from a spreadsheet using the stroke animator and a range selector to define the specific sentence.
I am now trying to automate a system which will localise 4 different Risk Warnings for up to 36 different languages at a time. So changing this range selector manually will be way too arduous to do manually.
My question is whether it is possible to add an expression to the start and end points of the range selector which will read a text layer containing a number imported from the spreadsheet?
In my head it’s a little bit similar to the way you have a hidden text layer dynamically importing the name of a font (e.g. ‘ArialMT-Bold’) which then gets fed into a font selector within a text layer - thus enabling you to dynamically change the font of different texts.
Any help on this would be greatly appreciated - I’m not an AE expert so I’m struggling to see what expressions would enable you to return the correct value for the range selector start/end based on a text layer’s data (i.e. the number imported from the spreadsheet).
Thanks
Jake
-
That should absolutely be possible! I’d recommend reviewing this post for some additional information, but basically, this is how we’d go about it.
First, we’d want to create two new text layers named “LRW rStart” and “LRW rEnd” (with no quotes). Once we’ve got these layers in our project and we’re sure that they’re bringing in the values we want, we should be able to move on to the next step.
From there, we’ll want to add an Animator to the text layer we want to change; I’d recommend “Stroke Color”. However, we’ll also need to click the “Add” button and add the “Stroke Width” and “Stroke Color>Opacity” properties. We’ll also want to adjust the “Stroke Width” and “Stroke Color” layers to create the Faux Bold effect. After that, we’ll want to expand the “Range Selector 1” property and drill down to the “Advanced” section.
In that area, we’ll want to set “Units” to “Index” and “Based On” to “Words”. Finally, we’ll want to go back to the “Start” and “End” values of the “Range Selector 1”. Alt/Option-click on the Stopwatch to the left of the word “Start”. This should open the Expression editor. For the “Start” Expression, we’ll want to reference the “LRW rStart” layer’s value. So, for that, we would use:
text.animator("Animator 1").selector("Range Selector 1").start,parseInt(thisComp.layer("LRW rStart").text.sourceText)-1
for the “End” value, we’ll want a similar expression that references our “End” number:
text.animator("Animator 1").selector("Range Selector 1").end,parseInt(thisComp.layer("LRW rEnd").text.sourceText)
That should, in theory, work for what you’re trying to achieve. However, depending on the format of the text, it might take some tweaking. For example, in the screenshot provided, it looks like the text is formatted in a single block, which might require us to make our calculations by the number of characters rather than the number of words.
Either way that should be enough to get you started. If you have any questions, please feel free to get in touch.
Thanks,
Jeff