ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

thisProperty

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Marcus Round
thisProperty
on Aug 13, 2014 at 3:11:17 pm

Newbie 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.


Return to posts index

Dan Ebberts
Re: thisProperty
on Aug 13, 2014 at 5:49:12 pm

It'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



Return to posts index

Alex Printz
Re: thisProperty
on Jun 13, 2018 at 5:23:50 pm

Dan, 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?


Return to posts index


Alex Printz
Re: thisProperty
on Jun 13, 2018 at 5:29:16 pm

for 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)
}


Return to posts index

Dan Ebberts
Re: thisProperty
on Jun 13, 2018 at 5:56:37 pm

Try 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



Return to posts index

Arjun Shrestha
Re: thisProperty
on Jun 13, 2018 at 6:11:34 pm

Is 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


Return to posts index


Dan Ebberts
Re: thisProperty
on Jun 13, 2018 at 9:25:53 pm

Probably. 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



Return to posts index

Alex Printz
Re: thisProperty
on Jun 13, 2018 at 6:25:55 pm

Thanks 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.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]