How can I set the text animator selector based on value with expressions?
Copy link to clipboard
Copied
I have set of text animators each with expression selectors that trigger different actions depending on the value of a drop down expression control on a control layer. So far this works great, but I need the based on value to change from words to lines or vice versa depending on another drop down control. Is there a way to add an expression to the based on parameter? Am I meant to add it to the amount expression? Ive tried using a switch like this (a total guess) and though it throws no errors it doesnt actually change the value of the based on parameter...
slctn = thisComp.layer("Controls").effect("Text Animation")("Menu");
switch (slctn)
{
case 1: setText.animator("Opacity").selector("Opacity").basedOn[3];
break;
case 2: setText.animator("Opacity").selector("Opacity").basedOn[4];
};
I am able to use a value and throw command to call the value of the based on parameter like this, so in theory it should be a value I can influence with an expression... right?
basedOn = text.animator("Opacity").selector("Opacity").basedOn.value;
throw basedOn
this throws values of 1,2,3 and 4 for characters, characters excluding spaces, words and lines respectively.
Im at a loss but it feels like this should be possible, I hope someone can help.
thanks
Copy link to clipboard
Copied
Expressions can only control properties that you can keyframe.
ctrl = thisComp.layer("Controls").effect("Dropdown Menu Control")("Menu");
if (ctrl == 1){
v = 100;
}
if (ctrl == 2){
v = 50;
}
if (ctrl == 3){
v = 25;
}
Will set the value of v to 100, 50, or 25 based on having the menu item set to 1, 2, or 3.
The Text/Animator/Advanced section does not have the ability to set keyframes for "Units" or "Based On" so you cannot access those options by an expression. If you cannot drag a pickwhip to a property, it is not accessable.
I am not sure how your project is going to be used, but if you open the Escential Graphics workspace, select a text layer, then select the comp and Solo Supported Properties, you can drag all of the properties in the Advanced sectiion of a text animator to the Escential Graphics panel and use them there or export the animation as a MOGRT and make those changes in Premiere Pro.
Copy link to clipboard
Copied
Thanks for your reply Rick. The thing is you can pickwhip to the based on property. So I was hoping there was a way around it. You can add expressions to set the text and change things like leading and tracking, which to my knowledge also can't be keyframed.
This project will end up being a mogrt template for a few folk in my production team (who aren't great with AE) to use in premier, so whilst adding the based on property to that panel may just be the work around I have to go with it isn't ideal.
Copy link to clipboard
Copied
The Based On property doesn't have a stopwatch, so it can't be animated via expressions (or keyframes) and you can't animate one property via an expression on a different property. So I don't think you're going to be able to do it.
Copy link to clipboard
Copied
Well that's a shame. Is the only alternative multiple versions of the text layers with opacity set to 0 when the drop-down is used? That seems like it would end up being a heavy project as AE will be processing the potential changes to the "invisible" layers right?
Copy link to clipboard
Copied
If the layer's opacity is set to zero, it will not have any measurable effect on render time unless there is an expression in the comp somewhere that is looking up and down the timeline (recursive) for changes. Personally, I should just use the Essential Graphics workspace. It is a very easy way to integrate all kinds of changes in templates, and the MOGRTs save a ton of time when used in Premiere Pro.

