Jump to content
Sign in to follow this  
ianfreeze

I need some expression help

Recommended Posts

Heres the deal. Im trying to link the scale of a layer in one comp to the scale in another comp and add 50 to it.

 

I assumed it would work like this

scale property>comp("main comp").layer("dolly").transform.scale+50

however, when I enter that it only alters one of the scale values, not both even though they are still linked.

6PtmRYO.png

How can I get both values to scale equally?

A cursory google search yielded a phone book of dan eberts stuff that I cant even begin to try to sift through. Thanks for your help.

Share this post


Link to post
Share on other sites

Hey Jordan,

 

1) yes, its linked to a null in the other comp that has equally scaled values

2) I tried the parentheses and it didn't change anything.

 

tangentially I started saying Please Excuse My Dear Aunt Sally over and over in my head.

Share this post


Link to post
Share on other sites

alright, after a lot of different google searches I came up with this

 

s=(comp("main comp").layer("07_main").transform.scale)+50;

[s[0],s[0]]

 

set my value + 50 to a variable, then assign that variable to each value in the scale array (I think I'm saying that right...)

anyway, seems like a backwards way to go about it, but it works.

 

ALSO, unlike position that has its array values defined as [0][1][2] scale has them BOTH defined as [0]

interesting stuff.

Edited by ianfreeze

Share this post


Link to post
Share on other sites

OMG is right. I don't even know where to start here

 

Guys, please at least download my free expressions series. It's free. It will teach you expressions. The design sucks and some of it is a tad out-dated, a little. But, this is all covered in the first two lessons.

 

http://www.graymachine.com/blog/after-effects-expressions-free

 

The s[0],s[0] this is simply LOCKING the two dimensions to the same s[0] value. However, arrays are all referenced the same way: array[0], array[1], array[2], etc.

 

The original question could have been answered like this:

 

comp("main comp").layer("dolly").transform.scale + [50,50]

 

Arrays need to add to arrays. You can't just add one. In fact, I'd prefer that AE throws up an error for this.. but instead it nicely adds "50" to your first part of the array and 0 to the the second. That's why you had the values you saw.

Share this post


Link to post
Share on other sites

This tripped me up when I first started learning expressions. When adding an expression, pay attention to what that property needs. If it's scale/position, then your expression needs to spit out more than one value.

Share this post


Link to post
Share on other sites

This tripped me up when I first started learning expressions. When adding an expression, pay attention to what that property needs. If it's scale/position, then your expression needs to spit out more than one value.

 

 

I thought about that, but thought that since these two values could be linked (proportionate scale), unlike position, that it could take a single input. I was wrong.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...