Skip to main content
maxs33068394
Participant
January 17, 2019
Question

Expression to stop scaling in Child connected to Parent on Scale-Slider?

  • January 17, 2019
  • 1 reply
  • 2793 views

Hey gang- hope all is well.
I'm doing an After Effects project for a client, and I'm by no means an expert, and I need some help figuring out how to get some expressions working properly in relation to some parenting.
I'll see if I can describe it sans-pictures but I'll be happy to provide them if necessary.
There's three aspects to this particular bit of motion graphics- two parallel vertical lines (one parented to the other), one slider controlling ONLY the height-scale of the line (only attached to one line, but the other is parented to said line so it affects the height of both lines), and two separate little "dangly-bits" that extend and scale out of the bottom of the lines as they finish animating.
My client wants the slider to control the height of the lines for easy adjustment for future projects, without distorting or stretching the little flairs that come off them regardless of the size. Easy enough, as I've said I've got one line set to only scale vertically to the slider with this expression I found:
temp=thisComp.layer("VerticalSlider").effect("Slider Control")("Slider");
[temp,100]
The second line is then parented to this line, and voila, they scale just like I want.

The problem comes with the dangly-bits. I want them to always be at the same position hanging off the bottom of the line no matter the length of the lines they're on. Parenting them to the lines themselves does this, but they scale vertically and squish or extend in accordance with the lines' extending with the slider.
I'm trying to figure out if there's an expression I can put into both the dangly-bits so that they will MOVE with the lines (which are not actually moving position, but scaling to become longer), but not SCALE. I've found several expressions from google results and YT videos that seem like they should work based off descriptions, but they only make the distorting problem worse.
Would love some help on this- project's not technically due until saturday but the client would love me to show a close-to-finished project today.
Thank you so much for your help- let me know if anyone needs any more information.

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
January 17, 2019

This should work:

L = thisLayer;

s = transform.scale.value;

while (L.hasParent){

  L = L.parent;

  for (i = 0; i < s.length; i++) s *= 100/L.transform.scale.value

}

s

Dan

maxs33068394
Participant
January 17, 2019

Sadly this doesn't seem to work:

You can see that as I move the slider, the one "dangly bit" with the expression on it becomes wildly distorted, moreso than without it.

But we're on the right track! Do you know where to go from here?

Dan Ebberts
Community Expert
Community Expert
January 17, 2019

My guess is that it has to do with skewing that happens when you combine rotation and non-uniform scaling. I'm not sure what to do about it though.

Dan