ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Changing Scale of Child relative to Parents H/W

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sean Dunn
Changing Scale of Child relative to Parents H/W
on Jun 21, 2017 at 2:25:25 pm

This is the effect I'm looking for http://imgur.com/a/EubDf

I created it using 4 precomps, keyframed the first 4 frames with the correct scales I wanted. Then in a master comp, using time remap on all precomps linked to a slider to animate between the preset keyframes.

This idea works for static images, but I'm looking for a way to get the same slider control to drive all four panels without messing with time so I can add secondary animation to the objects within each box.

Below I have a expression I found from Dan Ebberts, and it gets me half way there. With the child layer parented and this expression pasted in the scale, the child stays centered but doesn't scale up or down relative to the width and height of the parent while maintaining the childs original scale restraints.

L = thisLayer;
s = transform.scale.value;
while (L.hasParent){
L = L.parent;
for (i = 0; i &lt; s.length; i++) s[i] *= 100/L.transform.scale.value[i]
}
s


Return to posts index

Dan Ebberts
Re: Changing Scale of Child relative to Parents H/W
on Jun 21, 2017 at 4:23:45 pm

Something like this might work to keep the text in its correct aspect ratio as either dimension of its parent is scaled:

L = thisLayer;
s = transform.scale.value;
sp = parent.transform.scale.value;
[s[0]/sp[0],s[1]/sp[1]]*(sp[0] + sp[1])/2


Dan



Return to posts index

Sean Dunn
Re: Changing Scale of Child relative to Parents H/W
on Jun 21, 2017 at 5:33:45 pm

Worked perfectly, thank you!


Return to posts index

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