Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Inertial Bounce Scale – NOT starting from zero

  • Inertial Bounce Scale – NOT starting from zero

    Posted by Ed Stables on May 31, 2016 at 4:12 pm

    Hi
    I’ve been using this expression to add a bounce to scale:

    rate = 500;
    rampDur = value[0]/rate;
    freq = 3;
    decay = 5;
    w = freq*Math.PI*2;

    if (time < (inPoint+outPoint)/2){
    if (time < (inPoint + rampDur)){
    s = linear(time,inPoint,inPoint+rampDur,0,value[0]);
    }else{
    t = time – (inPoint+rampDur);
    s = value[0] + rate*Math.sin(t*w)/Math.exp(t*decay)/w;
    }
    }else{
    if (time > (outPoint – rampDur)){
    s = linear(time,outPoint-rampDur,outPoint,value[0],0);
    }else{
    t = (outPoint – rampDur) – time;
    s = value[0] + rate*Math.sin(t*w)/Math.exp(t*decay)/w;
    }
    }
    [s,s]

    What I don’t like about it is that it kicks in at the first frame of the layer, and always starts from zero. Is there a way to scale up from, say, 100% to 150% AND add a bounce to it? Preferably this wouldn’t need to occur at the start of a layer.
    Thank you
    Ed

    Dan Ebberts replied 10 years, 2 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    May 31, 2016 at 5:04 pm

    Like this maybe:


    tStart = 1;
    startVal = [100,100];
    endVal = [150,150];
    dur = .2;
    freq = 3;
    decay = 5;
    w = freq*Math.PI*2;
    t = time - tStart;
    if (t < dur){
    linear(t,0,dur,startVal,endVal);
    }else{
    amp = (endVal - startVal)/dur;
    w = freq*Math.PI*2;
    endVal + amp*(Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w);
    }

    Dan

  • Ed Stables

    May 31, 2016 at 6:57 pm

    Dan, thank you!
    It took me a while to work out what you did, but thanks so much. That’s a really useful expression, and I know it’s really going to come in handy. I just bought you a coffee via your tip jar.
    Hugely appreciated
    Ed

  • Dan Ebberts

    May 31, 2016 at 7:29 pm

    Glad you found it useful! Thanks for the tip–I appreciate it.

    Dan

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