Activity › Forums › Adobe After Effects Expressions › Scale layer to push other layer position
-
Scale layer to push other layer position
Posted by Madli Man on February 23, 2014 at 5:49 pmHi forum,
I have 3 layers side by side and each layer anchor point to left end of layer.
I want to scale[0] layer A and push layer B & C position to be side by side base each other scale.I found this code by Dan. but i have limited knowledge in expression. Please help 🙂
Thank you
L = thisComp.layer("A")
value + [(L.scale[0]-100)*(L.height-L.anchorPoint[0])/100,0];Adam Wiltgen replied 8 years, 8 months ago 3 Members · 6 Replies -
6 Replies
-
Dan Ebberts
February 23, 2014 at 8:59 pmTry this for layer B:
L = thisComp.layer(“A”);
[L.transform.position[0] + L.width*L.transform.scale[0]/100,value[1]];and this for layer C:
L = thisComp.layer(“B”);
[L.transform.position[0] + L.width*L.transform.scale[0]/100,value[1]];This assumes anchor points on the left and no layers are parented.
Dan
-
Adam Wiltgen
September 7, 2017 at 9:24 pmIs there a way to make each layer push the others responsively?
For example:
If scaling Layer B, Layer A and C move and scale outward to make room. Or If scaling Layer C, Layer A and B move and scale left to make room. Basically locking the layers to never go past the comp boundaries.I made a mockup GIF of a comp with no expressions to illustrate my idea:

Adam Wiltgen
-
Dan Ebberts
September 7, 2017 at 9:40 pmI think it would be tricky to set up unless you had the algorithm for all the pieces in one expression, so that expression would know which pieces are scaling and which are reacting. Maybe an invisible text layer that would publish its results as an array of scale values and each layer would parse the text to determine its own scale at the current frame. Even with that, it would still be some work to defined and code the algorithm.
Dan
-
Adam Wiltgen
September 8, 2017 at 2:50 pmThank you for the quick response Dan!
I have broken my brain attempting to get this to work and it’s nice to know that the difficulty isn’t just in my own limited knowledge.
Adam Wiltgen
-
Adam Wiltgen
September 8, 2017 at 7:48 pmThank you for the quick response Dan!
I have broken my brain attempting to get this to work and it’s nice to know that the difficulty isn’t just in my own limited knowledge.I figured out a method that works for me and I’ve attached the project below.
I ended up with 4 (equal sized and very tall) comps and 3 Nulls attached to where the comps meet.
The left and right-most comps are locked in position and all the comps except the right-most comp have left aligned anchor points. The right has a right locked anchor point.
Then the x position of each null determines the scale and position of the comps to its side.
The rest is basically magic to me. But it works!
11661_r18responsivecomp.aep.zip
I’m pretty new to this forum so please feel free to update or tear it a new one. I’m open to any and all criticism.Thanks to the linear expression and all the help of this forum, I have what I need to move forward with our 2018 Conference graphics!
Adam Wiltgen
Reply to this Discussion! Login or Sign Up