ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Changing Scale Based on Position

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Louis Hamwey
Changing Scale Based on Position
on Dec 7, 2017 at 6:25:08 pm

I am trying to have the scale of 2 solids be controlled by the position of a shape layer using this expression:

a = 1;
b = thisComp.layer("Left_Bar").transform.yPosition;
d = length(a,b);
s = (d/width)*100;

e = thisComp.layer("Vertical_Bar").transform.xPosition;
f = 1;
g = length(e,f);
i = (g/width)*100;

[i,s]

When for the top solid it works perfectly as the line moves up, it shrinks. But for the bottom solid it moves the inverse (see gif: )
I think it's an easy fix, I am just not very advance with expressions. Thanks!


Return to posts index

Andrei Popa
Re: Changing Scale Based on Position
on Dec 8, 2017 at 9:15:40 am

Try replacing second layer s with s = thisComp.height - (d/width)*100 or if your layer has the anchor point on the bottom,
with s = transform.position[1] - (d/width)*100

Andrei
My Envato portfolio.


Return to posts index

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