Activity › Forums › Adobe After Effects Expressions › thisProperty
-
thisProperty
Posted by Marcus Round on August 13, 2014 at 3:11 pmNewbie question.
I want a camera in one comp to have the exact same attributes as a camera in another comp.
comp(“MasterComp”).layer(“MasterCamera”).thisProperty
results in error:
“property or method named ‘thisProperty’ in Class ‘Camera’ is missing or does not exist.
Dan Ebberts replied 7 years, 10 months ago 4 Members · 7 Replies -
7 Replies
-
Dan Ebberts
August 13, 2014 at 5:49 pmIt’s more complicated than that. This is one way to do it:
str = '("' + thisProperty.name + '")';
i = 1;
while(thisProperty.propertyGroup(i).name != thisLayer.name){
str = '("' + thisProperty.propertyGroup(i).name + '")' + str;
i++;
}
str = 'comp("MasterComp").layer("MasterCamera")' + str;
eval(str)
Dan
-
Alex Printz
June 13, 2018 at 5:23 pmDan, I am trying to use a light version of this, but after the string is evaluated the values are getting capitalized, making AE return undefined errors.
If I put this into an opacity property of a layer, it should be evaluating as “transform.opacity”, and hence referencing itself.
str = '("' + thisProperty.name + '")';
i = 1;
while(thisProperty.propertyGroup(i).name != thisLayer.name){
str = '("' + thisProperty.propertyGroup(i).name + '")' + str;
i++;
}
eval(str)
However, I am getting “Error at line 1 in property ‘Opacity’ of layer…. Function “Transform” is undefined., an expression was disabled…Any idea how to fix this? I’m not too privy to eval function, and what I read there aren’t simple controls, and it looks like a lot of web developers avoid it for problems like this.
I’ve tried a simple string parse, but that doesn’t help.
function jsUcfirst(string) return string.charAt(0).toUpperCase() + string.slice(1);
If it parse’s before the eval the string change is ignored and still evaluated as capitals, and if it’s after then it’s returned to a string and not being executed. Any ideas anyone? -
Alex Printz
June 13, 2018 at 5:29 pmfor reference, I was trying to build a simple expression that could be placed into any property and reference a guide layer of itself inside another comp via pulldown.
referenceProperty = pathToThis();
targetLayer = effect("Reference Layer")(1);
thisName = thisLayer.name;
targetInsideComp = comp(targetLayer.name).layer(thisName);
targetInsideComp[referenceProperty]valueAtTime(time-targetLayer.inPoint);;function pathToThis(){
str = '("' + thisProperty.name + '")';
i = 1;
while(thisProperty.propertyGroup(i).name != thisLayer.name){
str = '("' + thisProperty.propertyGroup(i).name + '")' + str;
i++;
}
return eval(str)
} -
Dan Ebberts
June 13, 2018 at 5:56 pmTry it this way:
str = '("' + thisProperty.name + '")';
i = 1;
while(thisProperty.propertyGroup(i).name != thisLayer.name){
str = '("' + thisProperty.propertyGroup(i).name + '")' + str;
i++;
}
str = "thisLayer" + str;
eval(str)
Dan
-
Ethan Dolan
June 13, 2018 at 6:11 pmIs there any way to trigger a specific animation in a layer property. For eg, i have three animations in the position property of a layer from 0 to 20 frames, 1:20 sec to 1:40 sec and 2:00 to 2:20 sec. How can the animation between 1:20 to 1:40 can only be triggered while playing the entire timeline. Is this even possible?
Thankyou
-
Alex Printz
June 13, 2018 at 6:25 pmThanks Dan!
Between the two examples I think I understand I needed to assemble the whole line of code before the evaluation; I couldn’t use eval to build myself a string of properties to call later. Neat.
-
Dan Ebberts
June 13, 2018 at 9:25 pmProbably. The expression would need to detect the triggering event, figure out how long ago it happened, and use valueAtTime() to get the appropriate value from the 1:20 to 1:40 range.
Dan
Reply to this Discussion! Login or Sign Up