ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

After Effects + JavaScript: How to change the position of a single axis?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Conor Grebel
After Effects + JavaScript: How to change the position of a single axis?
on Dec 3, 2011 at 12:43:45 am

I couldn't find the answer to this anywhere...

I can see how you run a command to effect all 3 axis at once

myLayer.position.setValue( [ 50, 50, 50 ] );

but I want to change only the Z position of a layer, without affecting its current x and y.

is there no position[2]...?

could somebody tell me how to change only the Z axis from javascript?

THANK YOU


Return to posts index

Steve Blacker
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 3, 2011 at 3:12:42 am

The third "50" represents your z position, as far as I can tell...

It's only work if you'd rather be doing something else...


Return to posts index

Conor Grebel
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 3, 2011 at 3:19:24 am

yes that much is clear to me. but I want to effect ONLY the z position. if i ran that command then it would effect x y and z. i want the current x and y to remain as they are, and only effect the z position. Please read my original post...
Does that make sense?


Return to posts index


Darby Edelen
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 3, 2011 at 8:38:14 am

[Conor Grebel] "yes that much is clear to me. but I want to effect ONLY the z position. if i ran that command then it would effect x y and z. i want the current x and y to remain as they are, and only effect the z position. Please read my original post...
Does that make sense?"


Is this for a script? If you're working on a script then I don't have specific code to give you, but I'm much more familiar with expressions where you could handle this like so:


z = 50;
myLayer.position + [0,0,z];


I think similar code should work in a script. Take the current value and add a 3d vector to it. If you want to replace the z value (instead of altering it) then it might be more complicated but still doable. I'd look into javascript array object methods, maybe splice().

Darby Edelen


Return to posts index

Conor Grebel
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 3, 2011 at 8:56:34 am

yeah i'm looking for script, not expressions. I'll look into implementing that code but it doesnt work as is...
I'll keep researching but..thanks anyways!


Return to posts index

Steve Blacker
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 3, 2011 at 12:56:36 pm

Could you separate the x, y and z position parameters on the layer and apply the expression to each? (Right click on the position parameter in the layer timeline)

It's only work if you'd rather be doing something else...


Return to posts index


Conor Grebel
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 4, 2011 at 10:25:12 pm

Still looking for an answer on this...


Return to posts index

Steve Blacker
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 5, 2011 at 12:06:40 am

You may have better luck at http://aescripts.com/

It's only work if you'd rather be doing something else...


Return to posts index

Conor Grebel
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 5, 2011 at 12:09:22 am

thank you!


Return to posts index


Gleb Rysanov
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 7, 2011 at 3:07:30 pm

Hello Conor,

As far as I understand your question, the goal is to change z position only, leaving x and y dimensions as they are? If so, solution is simple:

x = value;
y = value;
z = (whatever you want it to be);
[x,y,z]

or simpler yet:

[value,value,z]


Return to posts index

Conor Grebel
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 7, 2011 at 10:31:49 pm

Now I know that works or expressions, are you sure that works for JavaScript ? I believe I tried that method but it could not recognize "value"


Return to posts index

Gleb Rysanov
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 8, 2011 at 9:42:57 am

Oh...sorry, I thought you was talking of expressions...those also use Java language, don't they?


Return to posts index


Conor Grebel
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 8, 2011 at 10:15:34 pm

yes you thought it was expressions. Even though In my initial post and in EVERY POST AFTER THAT I wrote "not about expressions, please read description"

Please if somebody can help me I would appreciate it...


Return to posts index

Steve Blacker
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 8, 2011 at 11:45:58 pm

Actually, your original post didn't explicitly state that you were attempting to write a script, per se, and since most questions here *would* pertain to expressions rather than scripts, I think it's an oversight that can be forgiven, no?

Did you not have any luck with your question over at aescripts.com?

Because if you can get help with scripting anywhere, it's there. Perhaps you need to think of alternate ways to achieve the result you're after.

It's only work if you'd rather be doing something else...


Return to posts index

Conor Grebel
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 8, 2011 at 11:58:03 pm

I did write Javascript. yes I posted there but no response...
I'm getting frustrated because every response has been for expressions...


Return to posts index


Steve Blacker
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 9, 2011 at 12:06:07 am

I see two responses to your post there, one from Lloyd, who is a veritable script guru. Neither of those suggestions helped?

It's only work if you'd rather be doing something else...


Return to posts index

Touko Maksimainen
Re: After Effects + JavaScript: How to change the position of a single axis?
on Jan 12, 2015 at 8:04:43 am
Last Edited By Touko Maksimainen on Jan 12, 2015 at 8:15:49 am

app.project.item(1).layer("").property("Position").getSeparationFollower(0).setValue=value;

0 for x, 1 for y, etc.


Return to posts index

Dusan Marinkovic
Re: After Effects + JavaScript: How to change the position of a single axis?
on Dec 21, 2015 at 6:13:30 pm

app.project.item(1).layer("").property("Position").getSeparationFollower(0).setValue=value;

This doesnt seem to work, value is not set with new value.
Can anyone explain how to use properly Property methods and attributes related to the Separate Dimensions feature(dimensionsSeparated,getSeparationFollower,isSeparationFollower,isSeparationLeader,separationDimension,
separationLeader)?


Return to posts index

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