FORUMS: list search recent posts

Applying expressions via a script - problems with variables

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Simon Björk
Applying expressions via a script - problems with variables
on Jan 4, 2011 at 9:45:58 am

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?


Return to posts index

Dan Ebberts
Re: Applying expressions via a script - problems with variables
on Jan 4, 2011 at 4:11:44 pm

In your example, is myCamera a variable within your script that holds the name of a camera? If so, this should work:

myLayer.rotation.expression = myCamera + ".transform.zRotation";

Dan



Return to posts index

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