ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

display layer movement direction

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alex Weil
display layer movement direction
on Apr 10, 2018 at 6:19:03 pm

Hey Cows,

is it somehow possible to display the direction a Layer is moving?

for example:
i have a Text-layer in the middle of the composition, if it moves to the left, it should say left. Than it goes to the right and it says right.

cheers
Alex


Return to posts index

Dan Ebberts
Re: display layer movement direction
on Apr 10, 2018 at 6:53:08 pm

Try this:

v = toCompVec(position.velocity);
if (v[0] < 0) "Left" else "Right"

You may want to add a third option for when it's not moving left or right.


Dan



Return to posts index

Alex Weil
Re: display layer movement direction
on Apr 10, 2018 at 7:25:14 pm

thanks Dan,

maybe you can help me with a similar expression? i'll post it underneath. i have a layer parented to a second layer. when the "master" layer moves left, the "slave" layer rotates with a positive value, when it moves left, it should rotate to a negative value. at the moment i have an if/else driven checkbox expression. maybe there is a way to somehow combine the expressions?


(i hope my english is good enough to make my case clear).

if (effect("Checkbox Control")("Checkbox")== 1){
r= -1 ;
}else{
r= 1 ;
}

x=thisComp.layer("Shape Layer 1").transform.position;
(x.speed/30)*r


Return to posts index


Dan Ebberts
Re: display layer movement direction
on Apr 10, 2018 at 8:27:44 pm

Something like this maybe:

v = parent.toCompVec(parent.position.velocity);
r = (v[0] < 0) ? -1 : 1;
(parent.position.speed/30)*r


You might have to reverse the -1 and 1, if I got it backwards.


Dan



Return to posts index

Alex Weil
Re: display layer movement direction
on Apr 10, 2018 at 9:15:54 pm

brilliant as always, Mr. Ebberts ☺ thanks so much


Return to posts index

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