Copy link to clipboard
Copied
Good afternoon.
I want to link the z position of the layer to the Slider Control, which is assigned as an effect for this layer.
var myCarrentComp = app.project.activeItem;
var varCamPosZ = myCarrentComp.layer(1).transform.position.value[2];
myCarrentComp.layer(1).Effects.addProperty("Slider Control");
var PosZCode = "effect(\"Slider Control\")(\"Slider\");";
myCarrentComp.layer(i).transform.position.value[2].expression =PosZCode;
I thought the Slider Control effect would be related to the z position of the layer.
But this is not happening. Is there anyone who can help with this issue ???
Is there a command to separate the position of a layer of type Separate Dimensions???
Copy link to clipboard
Copied
Few things wrong in your code:
if (value.length !== 3) {
[value[0], value[1]];
} else {
[value[0], value[1], effect("Slider Control")("Slider")];
}
Final code could look like this:
(function() {
var composition = app.project.activeItem;
if (!composition || !(composition instanceof CompItem)) {
return alert('Please select composition first');
}
var layer = composition.selectedLayers[0];
if (!layer) {
return alert('Please select a layer');
}
var slider = layer.property('ADBE Effect Parade').addProperty('ADBE Slider Control');
var expression = 'if (value.length !== 3) {\r' +
'\t[value[0], value[1]];\r' +
'} else {\r' +
'\t[value[0], value[1], effect("' + slider.name + '")("ADBE Slider Control-0001")];\r' +
'}';
layer.transform.position.expression = expression;
})();
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more