Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions scaling with expressions

  • scaling with expressions

    Posted by Clemensk on May 9, 2006 at 4:53 pm

    I have tons of layers which have to be scaled from 0 to 100 over a length of 10 frames, starting at the inpoint of the layers and scaled from 100 to 0 at the end.
    Doing this with expressions could save me a lot of time but i can’t figure out how to do this.

    Anybody can help?

    best regards
    Clemens

    Dan Ebberts replied 20 years, 4 months ago 2 Members · 4 Replies
  • 4 Replies
  • Clemensk

    May 9, 2006 at 5:52 pm

    i found a simple solution myself but maybe you can help me to improve the script. the layer is scaled now linear from 0 to 63 beginning at the inpoint. It would surely look better if it goes from for example from 0 to 80 in 10 frames and from 80 to 63 in 3 frames.

    any ideas.

    best regards
    Clemens

    adjust = 90

    temp= time – inPoint;
    temp = temp * adjust
    temp =Math.min(temp, 63) ;

    outtemp= outPoint -time;
    outtemp = outtemp * adjust
    outtemp =Math.min(outtemp, 63) ;
    temp =Math.min(temp, outtemp) ;

    [temp,temp]

  • Dan Ebberts

    May 9, 2006 at 6:46 pm

    I’m not sure what your expression does, but I think this one does what you originally asked for:

    f = 10; // number of frames to ramp
    t = f*thisComp.frameDuration;
    s = Math.min(linear(time,inPoint,inPoint+t,0,100),linear(time,outPoint-t,outPoint,100,0));
    [s,s]

    Dan

  • Clemensk

    May 9, 2006 at 7:07 pm

    thank you for your reply.

    nice script, looks much better than the one i figured out, but basically they do the same. Do you have a solution for my second question too? some sort of easing which slightly overshoots the target value.
    for example 0 > 120 > 100

    ???

    Clemens

  • Dan Ebberts

    May 9, 2006 at 8:36 pm

    OK – try this:

    f1 = 10; // ramp on/off frames
    f2 = 3; // overshoot frames

    max = 80; //maximum scale value
    hold = 63; // hold scale value

    t1 = f1*thisComp.frameDuration;
    t2 = f2*thisComp.frameDuration;

    if (time <= inPoint + t1 + t2){ s = Math.min(linear(time,inPoint,inPoint+t1,0,max),linear(time,inPoint+t1,inPoint+t1+t2,max,hold)); }else{ s = linear(time,outPoint-t1,outPoint,hold,0); } [s,s] Dan

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