Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Interpolation – make it endless

  • Interpolation – make it endless

    Posted by Zsolt Koppányi on October 28, 2015 at 9:15 pm

    Hello,
    I’m new to javaScript,and was wondering how to achieve a pulse with Opacity changes not to use the traditional Math.sin() or Math.cos() method.
    I’d like to use Interpolation methods to change Opacity from 0% to 100% and make it every two seconds and let these changes in this range last forever.
    I know the classic interpolations, and I’d add the following expression to the layer’s Opacity:

    ease(time,inPoint,2-inPoint,[0],[100])

    …It will change only the first two second. But what to modify to make it endless?

    Thanks

    Zs

    303450b93926828312687568

    Zsolt Koppányi replied 10 years, 10 months ago 2 Members · 10 Replies
  • 10 Replies
  • Dan Ebberts

    October 28, 2015 at 9:29 pm

    Do you mean you want it to repeat? Something like this should work:

    d = 2; // duration
    t = (time – inPoint)%d;
    ease(t,0,d,0,100)

    Dan

  • Zsolt Koppányi

    October 28, 2015 at 10:32 pm

    Thank you, It works perfectly!
    That’s what I thought about (repeating interpolation).

    Just for satisfying my curiosity, what does the second row mean basically?

    t = (time – inPoint)%VARIABLE;

    Zs

  • Dan Ebberts

    October 28, 2015 at 10:42 pm

    It just loops t from 0 to 2, every 2 seconds (starting at the layer’s in point).

    Dan

  • Zsolt Koppányi

    October 28, 2015 at 10:54 pm

    Thanks, I’ve learnt a lot!

    Zs

  • Zsolt Koppányi

    October 29, 2015 at 10:22 pm

    A thought crosses my mind about using this modulo (%) expression. I noticed it works like loopOut(“cycle”) expression with keyframes. Is there a similar modulo expression which corresponds to loopOut(“pingpong”)?
    The reason is to get a smooth (ease) reverse to the start…

  • Dan Ebberts

    October 29, 2015 at 11:19 pm

    One way:

    d = 2; // duration
    t = (time – inPoint)%d;
    n = Math.floor((time – inPoint)/d);
    n%2 ? ease(t,0,d,100,0) : ease(t,0,d,0,100)

    Another:

    d = 2;
    50*(Math.sin((time – inPoint)*Math.PI/d – Math.PI/2) + 1)

    Dan

  • Zsolt Koppányi

    October 30, 2015 at 9:34 pm

    Many thanks again Dan!

    The first is a bit difficult for me to decode, however works as I thought.

    Zs

  • Zsolt Koppányi

    November 2, 2015 at 5:57 pm

    Hello,
    I rewrote your first expression for two-dimensional properties.
    I applied it for Scale and converted the ternary operator to if/else conditional (because it’s understandable for me) but seems I made a mistake in it. Could you point at where I did it?
    Thank you…

    d = 2; // duration
    t = (time - inPoint)%d;
    n = Math.floor((time - inPoint)/d);

    if (value == n%2)
    {
    ease(t,0,d,[value[0]+500,value[1]+500],[value[0],value[1]])
    }
    else
    {
    ease(t,0,d,[value[0],value[1]],[value[0]+500,value[1]+500])
    }

  • Dan Ebberts

    November 2, 2015 at 6:16 pm

    Try changing this:

    if (value == n%2)

    to this:

    if (n%2)

    Dan

  • Zsolt Koppányi

    November 3, 2015 at 2:03 pm

    Oh my… It seems I over-complicated the conditional…
    With this simple modification it goes like a dream!
    Thank you, Dan!

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