Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Animating a layer based on another layer’s height

Tagged: 

  • Animating a layer based on another layer’s height

  • Armand Bakx

    January 24, 2021 at 1:43 am

    Hello,

    I’m relatively new to working with expressions in AE and I fear this is going to be a relatively easy problem to solve, yet I have been trying things and reading around on the internet for a couple of hours now and I can’t seem work it out.

    The problem is simple: There are two objects, one (non-rectangular shape layer acting like a mask for an image) above the other (just an image), small margin in between them(20px), both with anchor points to their top left. I would like the Y-position of the object on the bottom to increase/decrease according to a size increase/decrease of the object on top, giving the impression that the object on the bottom is being ‘pushed’ by the growth of the other.

    Via a tinkered version of an expression found on a different board I managed to get this principle working in the width-/X-dimension:

    L = thisComp.layer(“A”);

    rect = L.sourceRectAtTime(time,false);

    x = L.toComp([rect.left+rect.width,0])[0];

    [x, value[1]]

    yet when I try to implement this for y/height either the object on the bottom doesn’t move at all, moves disproportionally, or moves according to the. All my attempts have been variations of this expression, or more rudimentary versions, unfortunately all to no avail.

    I hope someone is willing and able to help me out find out what it is I’m failing to see. It’s aggravating to me I’m struggling with something that, in principle, should be quite simple.

    Thanks a lot in advance. I’m more than willing to share any more information if necessary.

Viewing 1 of 1 posts

Log in to reply.

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