Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Maintaining distance between layers, even if I scale the center one

  • Maintaining distance between layers, even if I scale the center one

  • aniello ferrone

    May 27, 2018 at 10:22 pm

    Hi!
    In this period i’m experimenting and studying a lot expressions for motion graphic template, and now i’m facing another wall ☺

    Let’s say I have 3 elements (the 2 text box and the comma graphic, as in the following image)

    And let’s say I wanna scale the center box, but no matter how much I scale it, I always want the other 2 elements (the up and down ones) mantaining he same distance from the center one. How can I do it?

    Witch expression may I use? Can SourceRectAtTime be useful in this case?

    Thanks so much again
    Waiting for a kind answer

    Aniello Ferrone
    Viral Video Editor
    http://www.fanpage.it

  • Dan Ebberts

    May 27, 2018 at 11:50 pm

    Something like this should work for the upper:

    gap = 25;
    L = thisComp.layer(“Middle Text”);
    r = L.sourceRectAtTime(time,false);
    hisUL = L.toComp([r.left,r.top]);
    r2 = sourceRectAtTime(time,false);
    myLR = toComp([r2.left+r2.width,r2.top+r2.height]);
    value + [0,hisUL[1] – myLR[1]-gap]

    and something like this for the lower:

    gap = 25;
    L = thisComp.layer(“Middle Text”);
    r = L.sourceRectAtTime(time,false);
    hisLR = L.toComp([r.left+r.width,r.top+r.height]);
    r2 = sourceRectAtTime(time,false);
    myUL = toComp([r2.left,r2.top]);
    value + [0,hisLR[1] – myUL[1]+gap]

    Dan

Viewing 1 - 2 of 2 posts

Log in to reply.

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