ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Scale layer to push other layer position

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Madli Man
Scale layer to push other layer position
on Feb 23, 2014 at 5:49:30 pm

Hi 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];




Return to posts index


Dan Ebberts
Re: Scale layer to push other layer position
on Feb 23, 2014 at 8:59:02 pm

Try 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



Return to posts index

Madli Man
Re: Scale layer to push other layer position
on Feb 23, 2014 at 9:58:13 pm

Thanks Mr Dan. Work as usual :)



Return to posts index


Adam Wiltgen
Re: Scale layer to push other layer position
on Sep 7, 2017 at 9:24:31 pm

Is 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


Return to posts index

Dan Ebberts
Re: Scale layer to push other layer position
on Sep 7, 2017 at 9:40:17 pm

I 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



Return to posts index

Adam Wiltgen
Re: Scale layer to push other layer position
on Sep 8, 2017 at 2:50:52 pm

Thank 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


Return to posts index


Adam Wiltgen
Re: Scale layer to push other layer position
on Sep 8, 2017 at 7:48:49 pm

Thank 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


Return to posts index

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