Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Trigger a linear function between two values of a slider multiple times

  • Trigger a linear function between two values of a slider multiple times

  • Samuel Figueiredo

    December 8, 2022 at 8:45 pm

    Hi! I’m trying to come up with a sollution that allows me to do the following:

    I have a slider controler, and I need to use it to trigger some properties. The problem I’m having is that I need to trigger an specific property between two values of the slider.

    For example

    src= slider;

    src between 4 and 8

    x=linear(src,4,8,10,20)

    src between 9 and 20

    x=25

    src between 21 and 28

    x=linear(src,21,28,110,120)

     

    Right now I’m trying to use the switch operator, but I think i’m doing something wrong:

    r=0

    switch(r){

    default:

    (anim !=3 && anim!=4)

    r=0;

    break;

    case 0:

    (anim==3 && src>=3 && src<=7)

    r=easeIn(src,3,7,0,2);

    break;

    case 1:

    (anim==3 && src>7)

    r=2;

    break;

    case 2:

    (anim==4)

    r=2;

    break;

    };

     

    Is there a way to achieve that?

    Thanks in advance!

  • Dan Ebberts

    December 8, 2022 at 9:16 pm

    It might be that you just need something like this:

    src = slider;
    if (src <= 8){
    x = linear(src,4,8,10,20);
    }else if (src < 21){
    x = 25;
    }else{
    x = linear(src,21,28,110,120);
    }

    but the fact that you’re using the word “trigger” makes me nervous…

  • Samuel Figueiredo

    December 8, 2022 at 9:31 pm

    Thank you very much, Dan!

    I simply forgot about if/else hahahaha

    Don’t worry, you don’t need to get nervous lol.

    Everything is working fine now!

Viewing 1 - 3 of 3 posts

Log in to reply.

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