PDA

View Full Version : Newbie scripting question


jussing
03-08-2008, 10:20 AM
Hey folks, I've used After Effects for years, but I've never touched the scripting part. I have some really simple issues here, I was hoping to get some help with. :)

I'd like a solution that'd work with AE 6.5, and not just CS3.


I want one NULL object's position to be driven by another NULL object, but multiplied by user-specified values. Something like null1.x = null2.x*0,5. I just don't know where to type it, or what's the syntax.
I also want an object in another composition to be moved opposite of the master NULL object, but I don't know what to write to get the value of an object in another comp.
Also, can you wire parameters to stuff from other comps, and then change the comp's name and it'd still work? Or would you have to change all the scripting that refers to that comp?
Thanks,
- Jonas

jussing
03-08-2008, 10:32 AM
OK, I'm too newb for myself, I figured the first one out:


Create Null1 and Null2
Click Position on Null2
Select "Animation -> Add expression" from the menu
Type in:
temp1 = 0.5*thisComp.layer("Null 1").position[0];
temp2 = 0.5*thisComp.layer("Null 1").position[1];
[temp1, temp2]
Easier than I thought. )

jussing
03-08-2008, 11:11 AM
OK, I found the other answers too:



To access another comp, type (for instance):

comp("Comp 1").layer("Null 1").position[0]
And no, if you change a comp's name, the scripts referring to that comp won't work. Hm!
I can't believe I've gone years without investigating this. I guess I thought it would be overly complicated.

- Jonas

Oh, and... it's "expressions", not "scripts". My bad.

dwigfor
03-12-2008, 12:58 AM
I'm not sure if comp names were changed, but in CS3, when you change a layer's name, expressions referring to that layer are automatically updated. VERY nice!

Glad you got your expressions figured out. Here's a shortcut that you may be interested in: To add an expression to a parameter, hold alt and click the animation divot next to the parameter.

Another thing you may not be aware of. Well, 2 things. First, just making sure you know about the pickwhip, for writing out the names of parameters... Secondly, if you want to modify values in an expression, you can tie them to an Expression Control effect. For the most part, I mainly use Slider controls.

CGTalk Moderation
03-12-2008, 12:58 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.