ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Scale in + out based on layer length

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
John Burgess
Scale in + out based on layer length
on May 2, 2020 at 7:18:52 pm
Last Edited By John Burgess on May 2, 2020 at 8:39:29 pm

I found the below expression for scaling a layer in and out based on its length which works well.

The issue is I was hoping to save it as a preset and this relies on the layer name being referenced which doesn't make it the most efficient when applying it to multiple layers at the same time.

Is there a way of simplifying this to allow it to be reusable or a better method?

John

startScale = [0,0];
endScale = [100,100];
layername = "Shape Layer 1";

if(time &lt; (thisComp.layer(layername).inPoint+thisComp.layer(layername).outPoint)/2)
ease(time,thisComp.layer(layername).inPoint,thisComp.layer(layername).inPoint+0.2,startScale,endScale)
else
ease(time,thisComp.layer(layername).outPoint-0.2,thisComp.layer(layername).outPoint,endScale,startScale);


UPDATE, SOLVED
Worked out solution by using index if anyone is interested

startScale = [0,0];
endScale = [100,100];

if(time < (thisComp.layer(index).inPoint+thisComp.layer(index).outPoint)/2)
ease(time,thisComp.layer(index).inPoint,thisComp.layer(index).inPoint+0.2,startScale,endScale)
else
ease(time,thisComp.layer(index).outPoint-0.2,thisComp.layer(index).outPoint,endScale,startScale);


Return to posts index

Dan Ebberts
Re: Scale in + out based on layer length
on May 2, 2020 at 9:39:17 pm

Actually, you can leave all that layer name/index stuff out:


startScale = [0,0];
endScale = [100,100];

if(time < (inPoint+outPoint)/2)
ease(time,inPoint,inPoint+0.2,startScale,endScale)
else
ease(time,outPoint-0.2,outPoint,endScale,startScale);



Dan



Return to posts index

John Burgess
Re: Scale in + out based on layer length
on May 2, 2020 at 9:46:10 pm

Great, even better.
Thanks very much Dan.


Return to posts index

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