Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Relative Position Shenanigans

  • Relative Position Shenanigans

    Posted by Jon Mitchell on October 15, 2013 at 3:51 pm

    Hello! First posting, have used these forums oh-so-many times for expression help. They actually have led me to crafting an expression that almost works, but not quite and I cant figure out why.

    The situation: 2 layers, one “parenting” the other and I want the “child’s” position to change relative to the parent starting at a certain time. (NOTE: the layers are not actually set as parent and child, they are only linked by the following expression)

    I used this expression:


    freeze = [960, 540]
    text = thisComp.layer("Show1").transform.position;

    timetoStart= 5.1

    if(time > timetoStart){
    text-sub(text, freeze);
    }else{freeze;}

    I figured the simple difference of a difference calculation would do the trick, but the expression just yields a constant 960, 540 as the position. I double checked and sub(text, freeze) does yield the proper difference (and it’s dynamic) but when I try to subtract the dynamic difference from text if yields a constant value.

    What’s going on? 🙁

    Jon Mitchell replied 12 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 15, 2013 at 4:22 pm

    I think you need to reference where the Show1 layer was at timetoStart.

    change this:

    text-sub(text, freeze);

    to this:

    text – text.valueAtTime(timetoStart) + freeze;

    Dan

  • Jon Mitchell

    October 15, 2013 at 4:28 pm

    Dan,
    Brilliant. Worked like a charm.

    Thank you!

    -Jon

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