Help with modifying previous code from Dan Ebberts
- April 24, 2023
- 1 reply
- 688 views
@Dan Ebberts I have to call on your expertise again. Remember when we came up with this:
L = thisComp.layer("Dropdown Menu");
menu = L.effect("Dropdown Menu Control")("Menu");
moveTime = thisComp.layer("Shape Dynamics").effect("Transition Duration (SS)")("Slider");
temp1 = " " + thisProperty.propertyGroup(1).name;
val = value;
if (menu.numKeys > 0){
n = menu.nearestKey(time).index;
if (time < menu.key(n).time) n--;
if (n < 2){
L1name = L.text.sourceText.valueAtTime(menu.key(1).time);
val = thisComp.layer(L1name).effect(name + temp1)("Slider").value;
}else{
t = menu.key(n).time;
L1name = L.text.sourceText.valueAtTime(menu.key(n-1).time);
v1 = thisComp.layer(L1name).effect(name + temp1)("Slider").value;
L2name = L.text.sourceText.valueAtTime(menu.key(n).time);
v2 = thisComp.layer(L2name).effect(name + temp1)("Slider").value;
val = ease(time,t,t + moveTime,v1,v2);
}
}
valThis worked flawlessly to help us use a dropdown menu to govern certain shape changes, and animate them according to a duration I specified.
Now I need to do something slightly different. In the original comp, all the shape dynamics were stored on individual layers in the same comp as the dropdown menu. Now, I have need of non-animated versions of a number of shots, and to do that I need to move the layers with the positions and sizes into a master comp (some later steps will depend on this; the idea is to move the calculations into a single place where all comps can call upon them).
The problem is, no matter how I try to tweak this, it gives me errors. Basically I need this expression to do the exact same thing we set it up to do, but instead of looking in thisComp for a layer name matching the value of the dropdown, I need it to look in comp("_Master Layouts").
I've been trying to fix this for almost two hours and it's still having issues. Either it can't find a layer matching the value from the dropdown, or it can't find the dropdown itself, and I can't figure out what isn't working.
I've uploaded the comp in its original configuration and an alternate version with the setup I'm trying to get to. Can you help?
