ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Constraint movement along X, Y and Z axis

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Rowan de Geus
Constraint movement along X, Y and Z axis
on Jun 21, 2019 at 9:45:04 am
Last Edited By Rowan de Geus on Jun 21, 2019 at 10:09:06 am

Hello reader,

I am struggling creating an expression to constrain movement of a layer to a certain angle. I found this isometric expression which works great:

pos = transform.position;
x = effect("X Movement")(1);
z = effect("Z Movement")(1);
y = effect("Y Movement")(1);
[x*Math.sqrt(3) + z*Math.sqrt(3) + pos[0], -x + z + y + pos[1]];

But how can I adjust this to match angles of 190 and 140?

EDIT: Found it for the X axis (thanks Dan):

x = effect("X Movement")("Slider");
a = 190;
y = -x*Math.tan(degreesToRadians(a));
value + [x,y]

But how to adjust this so Z has an angle of 140?


Return to posts index

Rowan de Geus
Re: Constraint movement along X, Y and Z axis
on Jun 21, 2019 at 11:07:43 am
Last Edited By Rowan de Geus on Jun 21, 2019 at 11:41:17 am

Got it:

pos = transform.position;
x = effect("X Movement")(1);
z = effect("Z Movement")(1);
y = effect("Y Movement")(1);
a1 = 190;
a2 = 40;
[x + z + pos[0], -x*Math.tan(degreesToRadians(a1)) + z*Math.tan(degreesToRadians(a2)) + y + pos[1]];


Return to posts index

Michael Szalapski
Re: Constraint movement along X, Y and Z axis
on Jun 28, 2019 at 5:05:26 pm

Thank you for sharing your solution!

- The Great Szalam
(The 'Great' stands for 'Not So Great, in fact, Extremely Humble')

No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.


Return to posts index

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