Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Scale in + out based on layer length

  • Scale in + out based on layer length

    Posted by John Burgess on May 2, 2020 at 7:18 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 < (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);

    John Burgess replied 4 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    May 2, 2020 at 9:39 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

  • John Burgess

    May 2, 2020 at 9:46 pm

    Great, even better.
    Thanks very much Dan.

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