ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
aniello ferrone
Maintaining distance between layers, even if I scale the center one
on May 27, 2018 at 10:22:38 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


Return to posts index

Dan Ebberts
Re: Maintaining distance between layers, even if I scale the center one
on May 27, 2018 at 11:50:01 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



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]