Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Sliders to control end keyframe

  • Sliders to control end keyframe

    Posted by Kieran Lefort on September 11, 2020 at 8:06 am

    Who’s in the mood for another expression discussion?
    I have layer that needs to move on the Y axis (dimensions already separated). It always starts in the same position, but the ending position needs to be linked to the values of two Math.rounded sliders that control other parts of the comp..

    So it always starts at Position A and I need to figure out an expression that says “if Slider no.1 = 1 and Slider no.2 = 1, then stop at Position B. If Slider no.1 = 2 and Slider no.2 =1, then stop at position C” and so on.

    Is this a valueattime thing, or have I got that wrong? I don’t want to know the value at a certain time, I need to dictate it. Do I need an intermediate third, reference slider to pull values from?

    There is a workaround, but that would involve making 68 comps and I’d much rather solve this than make 68 comps and then write the expression that controls them.

    Thanks in advance for any suggestions.

    EDIT: Actually, this can be controlled by just one of the sliders, which also cuts the workaround to 12 comps instead of 68. I’d still rather find a solution though.

    Kieran Lefort replied 5 years, 8 months ago 3 Members · 6 Replies
  • 6 Replies
  • Ron Lindeboom

    September 11, 2020 at 9:26 am

    Expressions discussions are much better served in the Adobe After Effects Expressions forum where they love to explore Expressions.

  • Filip Vandueren

    September 11, 2020 at 9:29 am

    How many of those sliders/combinations are there, I’m no entirely clear on why you would need that many precomps ?

    Anyway, you just need to setup some logic to determine the end-position first, then use a linear() or ease() function to do the animation…

    For example with a switch statement:

    sl=thisComp.layer("Null 1").effect("Slider Control")("Slider").value;

    startPos=[100,100];

    switch(sl) {

    case 1:

    endPos = [200,200];

    break;

    case 2:

    endPos = [200,300];

    break;

    case 3:

    endPos = [300,200];

    break;

    default:

    endPos = startPos;

    }

    ease(time, 1, 3, startPos, endPos);

  • Kieran Lefort

    September 11, 2020 at 9:35 am

    Apologies. This is my first time in the redesigned forum and couldn’t find it.

  • Filip Vandueren

    September 11, 2020 at 9:37 am

    Hi Ron, judging from the number of expressions questions that pop up here in the last few days, I’m guessing people have a harder time finding the other forum in the new layout.

    … As Kieran just pointed out while I was typing 🙂

  • Kieran Lefort

    September 11, 2020 at 9:42 am

    Oooh, this is exciting. I’ve not come across switch statements before. Thank you. I will adapt this to my comp.

    To answer your question: depending on the combination of slider values chosen by the user, there are 68 possible outcomes and I need to cater to all of them. I didn’t ask for this stupid thing, I just have to make it! Smile

  • Kieran Lefort

    September 11, 2020 at 9:50 am

    A further question for Filip: your example appears to be for one slider. How do I adapt switch(sl) to account for a second slider?

    Thanks.

    EDIT: Never mind. I’m redirecting the two sliders to an intermediate third invisible slider that I’ll point switch(sl) at.

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