Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions display layer movement direction

  • display layer movement direction

    Posted by Alex Weil on April 10, 2018 at 6:19 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

    Alex Weil replied 8 years ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 10, 2018 at 6:53 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

  • Alex Weil

    April 10, 2018 at 7:25 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

  • Dan Ebberts

    April 10, 2018 at 8:27 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

  • Alex Weil

    April 10, 2018 at 9:15 pm

    brilliant as always, Mr. Ebberts ☺ thanks so much

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy