ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Scale based on location/position

FAQ   •   VIEW ALL
 Scale based on location/position on Apr 13, 2012 at 5:02:34 pm

I have a horizontal row of images, all attached to a null. I need to move the position of the null horizontally and as each image gets to the center of the comp, it needs to scale up by a small percentage.

I'm not finding exactly what I need on this forum so any help would be greatly appreciated.

 Re: Scale based on location/positionon Apr 13, 2012 at 5:43:47 pm

This will increase the scale by 25% as the layer approaches the horizontal center of the comp:

pct = .25; // increase by 25%
r = 100; // distance to being increasing scale
center = thisComp.width/2;
p = toWorld(anchorPoint);
d = length(p,[center,p[1]]);
mult = ease(d,0,r,pct,0);
value*(1+mult)

Dan

 Re: Scale based on location/positionon Apr 13, 2012 at 6:17:35 pm

Brilliant!

Thank you!

 Re: Scale based on location/positionon Jul 16, 2020 at 7:28:03 am

Hi Dan, how would I adjust this to scale as it approaches the vertical?

 Re: Scale based on location/positionon Jul 16, 2020 at 5:47:10 pm

I haven't tested it, but it should be like this:

pct = .25; // increase by 25%
r = 100; // distance to begin increasing scale
center = thisComp.height/2;
p = toWorld(anchorPoint);
d = length(p,[p[0],center]);
mult = ease(d,0,r,pct,0);
value*(1+mult)

Dan