extendscript after effects add value to selection not by pos or rotation

Viewed 39

i want to add value based on what I selected on the comp,pos,rot,xyz which ever this is my code.

var myComp = app.project.activeItem;
myLayer = myComp.layer(1);
myLayer.transform.position.expression = 'wiggle(10,55)';

so I need to add selected or selection or whichever is needed here
myLayer.transform.position.expression
as you se it is using position instead of that cant I use selected properties or something

1 Answers

If I'm understanding you correctly, you'd like to add an expression to a selected property. This can be done by using selectedProperties. The code would look something like this:

var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers[0];
var exp = 'wiggle(10,55)';

if (myLayer.selectedProperties.length > 0) {
  myLayer.selectedProperties[0].expression = exp;
}
Related