Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Changing Scale of Child relative to Parents H/W

  • Changing Scale of Child relative to Parents H/W

    Posted by Sean Dunn on June 21, 2017 at 2:25 pm

    This is the effect I’m looking for https://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 < s.length; i++) s[i] *= 100/L.transform.scale.value[i]
    }
    s

    View post on imgur.com

    Sean Dunn replied 9 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 21, 2017 at 4:23 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

  • Sean Dunn

    June 21, 2017 at 5:33 pm

    Worked perfectly, thank you!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy