Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Checkbox Triggered Position Follow Issue

  • Checkbox Triggered Position Follow Issue

    Posted by Dagur Maunason on February 24, 2021 at 11:50 pm

    Hi!

    I have a first text block sitting centered in frame and a second one being animated upwards from the bottom. When a checkbox is activated the first text should start following the second one upwards at exactly the same distance as it had when it got triggered, both texts now moving as one unit. I got almost everything working except that the second block jumps when the switch is triggered, and I can’t for the life of me figure out how to make it work smoothly.

    Does anyone have a clue? Or maybe another decent solution for this?

    Here’s an example file and the expression looks like this

    x = position[0];

    y = position[1];

    orgY = position.valueAtTime(0)[1];

    mainY = thisComp.layer("Main Text").position[1];

    if ( thisComp.layer("Main Text").effect("Top Text Follow 2")("Checkbox") > 0 ) {

    [x,mainY-y]

    } else {

    [x,orgY]

    }

    Many thanks in advance!

    Dagur Maunason replied 5 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 25, 2021 at 12:25 am

    This expression makes some assumptions (which may not be correct), but it should get you headed in the right direction.

    L = thisComp.layer("Main Text");

    cb = L.effect("Top Text Follow 2")("Checkbox");

    if (cb.value){

    t = cb.numKeys > 0 ? cb.key(cb.numKeys).time : 0;

    p = L.position;

    y = p.value[1] - p.valueAtTime(t)[1];

    value + [0,y];

    }else

    value

  • Dagur Maunason

    February 25, 2021 at 2:37 pm

    Works flawlessly, you’re a lifesaver Dan, thanks a ton!!

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