Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Trigger Layer Position with Layer Marker

  • Trigger Layer Position with Layer Marker

    Posted by Earl Cabuhat on July 14, 2015 at 8:14 pm

    Hello community.

    I’m looking for an expression that triggers the position of a layer when a layer marker is placed. To be more precise, I have a 1920×1080 comp. When the playhead approaches a marker, I would like the comp to slide upwards revealing the next comp beneath it which I’m assuming would have to be parented to the first comp. The same thing will happen when the next marker is approached and so forth. Simple concept, but just seeing if there’s an easier way than using keyframes for this purpose.

    Transition time, 10 frames preferably. Easing in and out is possible, but not important.

    And if this is possible, I’m assuming its just as simple to alter, changing the y-axis transition to x-axis transitions?

    Expressions are definitely not my forté, and I couldn’t find anything online. I did find this where the scale is triggered by a marker
    https://www.motion-graphics-exchange.com/after-effects/Expressions-triggered-by-a-marker/49983ed7989ae

    Any help is appreciated.

    Thanks,
    Earl

    Philip Neves replied 10 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Earl Cabuhat

    August 10, 2015 at 3:13 pm

    Here’s the code if anyone’s interested. Added to the Null(Trigger) layer. Layer(s) parented to Null will be triggered with markers on the Trigger layer.

    offsetAmt = -1080;
    easeDur = .33;
    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time) n--;
    }
    yOffset = 0;
    if (n > 0){
    t = time - marker.key(n).time;
    yOffset = easeOut(t,0,easeDur,(n-1)*offsetAmt,n*offsetAmt);
    }
    value + [0,yOffset];

  • Philip Neves

    January 18, 2016 at 4:10 pm

    I also needed an expression to offset a null (parent for a set of lyrics) by a specific amount on a marker trigger (so the lyrics automatically rise on triggers, like a typewriter return). This is really helpful! Thank you for putting it online!

    I made a small modification so it’d take frames explicitly:

    offsetAmt = -100;
    easeFrames = 10;
    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time) n--;
    }
    yOffset = 0;
    if (n > 0){
    t = time - marker.key(n).time;
    yOffset = easeOut(t,0,framesToTime(easeFrames),(n-1)*offsetAmt,n*offsetAmt);
    }
    value + yOffset;

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