ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Y-POSITION layerA matches BOX DEPTH (YScale) on layerB

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Rose Draper
Y-POSITION layerA matches BOX DEPTH (YScale) on layerB
on Apr 13, 2018 at 1:03:06 am

HI There
Expressions Luddite here.
I'm trying to set up an expression where a precomp's Y position can slide up and down, retaining its relative position to a Grey box's Y depth on another layer. (so the name sits in relative position under a scalable (y) box)

I'll then take the setup over into Essentials, and create an editable text template for PPro (so when editor adjusts YScale of box, the text precomp (also editable) slides up/down with it). I think the correct properties are supported for this to work.

I can't get the expressions working properly, partly because I can't work out how to split the Scale properties into separate values to only pickwhip to Y scale.... and also because I don't really understand how the anchor points fit into expressions, so there is some diagonal sliding going on.... a bit messy.

Is there an expression that works for this? And where should I be setting my anchor points for it to work cleanly?
thanks in advance.

Return to posts index

Scott McGee
Re: Y-POSITION layerA matches BOX DEPTH (YScale) on layerB
on Apr 13, 2018 at 7:39:34 am

Not exactly sure but I'll take a stab at it.

Is there any reason why you are precomping.

me personally for what I think you are using this for.

I'd create a shape layer and use the expression to resize the box based on that. Then fix the text's position to the shape layer.

Put your text layer directly above the shape layer.

This then needs to be pasted into the shapes rectangle path size. I've included padding for breathing space.

padding = 20;
x = (thisComp.layer(index-1).sourceRectAtTime().width + padding) * thisComp.layer(index-1).transform.scale[0] /100;
y = (thisComp.layer(index-1).sourceRectAtTime().height + padding) * thisComp.layer(index-1).transform.scale[1] /100;

To lock the position, if you want it to scale from the center.

Anchor Point (This goes onto both, so when the size changes the anchor point always remains central)

r = sourceRectAtTime();
[r.left + r.width/2, + r.height/2]

Then make shape layer fixed to the text layer so you can move it around.

x = thisComp.layer(index-1).transform.position[0];
y = thisComp.layer(index-1).transform.position[1];

If you want it left or right aligned, just play with the anchor point on both layers.
Hope that is what you need.

Return to posts index

Rose Draper
Re: Y-POSITION layerA matches BOX DEPTH (YScale) on layerB
on Apr 13, 2018 at 11:43:30 pm

hi scott
i'll have to try it, and see what it does.
precomping from a previous design setup: the two separate layers of text animate in and out.
i'll return with outcome (/questions) in a day or so.
thanks again

Return to posts index

Rose Draper
Re: Y-POSITION layerA matches BOX DEPTH (YScale) on layerB
on May 4, 2018 at 5:40:59 am

hi there
very sorry for the delay: i STILL haven't had a chance to get back to this and work it out.

i've done a workaround which is fine for the .mogrt setup.
i'm having font issues between my AFX and the .mogrt i've designed when they're used remotely: i probably need to post about that in another section....

thanks again and much appreciated

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved