-
Applying expressions via a script – problems with variables
Say I have the following script.
var myComp = app.project.acitveItem;
var myCamera = myComp.layer(1);
var myLayer = myComp.layer(2);and I want to connect the rotation of my layer to the rotation of my camera. For that example,
myLayer.rotation.expression = “thisComp.layer(“Camera 1″).transform.zRotation”;
would work I guess. But what if I don’t know that the camera name is “Camera 1”? Is it possible to use the variable myCamera somehow? I mean, for example it would be easy if I could say: myLayer.rotation.expression = “myCamera.transform.zRotation”;. But that doesn’t work.
So my question is if it’s possible to use variables set in scripting to your expressions?