Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression for moving towards another layers position, and keep going past it…?

  • Expression for moving towards another layers position, and keep going past it…?

    Posted by Darryl Torke on June 29, 2013 at 7:54 pm

    Hello,

    here is my problem. I have a layer I am ‘aiming’ for (“target”) and another that I want to move towards that layer (“mover”). However, instead of it just going to the target location and stopping (ie: the linear/easeIn/easeOut expression), I’d like the “mover” layer to keep going past the target position.

    Ideally, I’d like to be able to simply duplicate the ‘mover’ layer and to multiple instances of it from different positions, yet they would all move towards (and past) the target.

    Would anyone know how this could be done?

    Peter Lee-jones replied 12 years, 3 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    June 29, 2013 at 11:41 pm

    This might work, depending on what you need:

    moveDuration = 2;
    moveStart = inPoint;
    moveEnd = moveStart+moveDuration;
    target = thisComp.layer(“target”).transform.position.valueAtTime(moveEnd);
    if (time < moveEnd)
    linear(time,moveStart,moveEnd,value,target)
    else
    target + (time-moveEnd)*(target-value)/moveDuration;

    Dan

  • Darryl Torke

    July 1, 2013 at 6:42 pm

    Thanks Dan! Worked like a charm.

    If you have the time, may I ask what is going on in the expression? I thought I would need to use a variety of math/trig functions to figure it out, but yours seems free of that. No worries if you do not have the time.

  • Dan Ebberts

    July 1, 2013 at 7:06 pm

    After the layer reaches the target, the expression just calculates the velocity vector per unit of time and multiplies that by the time that has elapsed since the target was reached and adds that vector to the target’s position. It only works because the move from the starting position to the target is linear.

    Dan

  • Peter Lee-jones

    March 13, 2014 at 12:17 am

    in a similar vein:
    I am looking for an expression which moves a layer to the position of the layer above it.
    Thus if I have layer 2 key-framed at position A, B then it will move over time to the (target)layer 1 key-framed at position C, D

    The idea is to apply this expression independently to individual layers to inherit a move towards the a layer above it.

    possible?

    So gravity would be a further advancement.

    Pinewood Studios, UK

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