Jump to content
Sign in to follow this  
jporter313

seemingly simple After Effects expression problem

Recommended Posts

I'm trying to create an expression that will attach each dimension of the position of a layer in After Effects to the position of another layer separately. I figured I could modify this expression I found to do it:

 

w = wiggle(1,50);
[value[0],w[1]]

 

as it addresses each dimension individually. The problem is, whenever I change that wiggle to anything else, for example:

 

w = 0;
[value[0],w[1]]

 

it throws an error:

 

Afer Effects warning: Class 'number' has no property or method named '1' Expression disabled.


Error occurred at line 3.
Comp: XXXXX
Layer: 2 XXXXX
Property: 'Position'

 

This doesn't make any sense to me. Anyone have any idea why it wouldn't allow me to use anything but a wiggle?

Edited by jporter313

Share this post


Link to post
Share on other sites

wiggle returns a 2 value array (e.g. xy coordinates). When you write w=wiggle(1,50), you're setting w to that 2-value array, so when you reference w[1] you're taking the y-value of that wiggle. When you switch it to w = 0, you're setting w to a number and not an array, so trying to get the value for w[1] will throw an error. If you're doing what I think you're trying to do, the easiest way is to set the position expression to something like:

 

layer1 = thisComp.layer(####);

layer2 = thisComp.layer(####);

 

[layer1.position[0], layer2.position[1]]

Where the #####'s are the index number, or name of the layers you're using

Share this post


Link to post
Share on other sites

wiggle returns a 2 value array (e.g. xy coordinates). When you write w=wiggle(1,50), you're setting w to that 2-value array, so when you reference w[1] you're taking the y-value of that wiggle. When you switch it to w = 0, you're setting w to a number and not an array, so trying to get the value for w[1] will throw an error. If you're doing what I think you're trying to do, the easiest way is to set the position expression to something like:

 

layer1 = thisComp.layer(####);

layer2 = thisComp.layer(####);

 

[layer1.position[0], layer2.position[1]]

Where the #####'s are the index number, or name of the layers you're using

 

Ahh, that totally makes sense now, thanks, I'll try it out in a bit.

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...