Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Slider to shift layer between 12 possible x/y 2D positions

  • Slider to shift layer between 12 possible x/y 2D positions

    Posted by Benjamin Arthur on April 23, 2019 at 7:13 pm

    Hi everyone – I’m working on a video template that I need to pass along to other animators. One sequence that will be repeated is smooth transitions between 12 possible comic frames, moving forward chronologically(no transitions are skipping frames or going backwards).

    Here’s my goal: Create a slider control that allows me to shift between only those 12 positions. I’m a beginner when it comes to javascript, but I wouldn’t want anyone to write out the whole code for me, I just need to understand how to approach this. I assume I can create the positional data as variables in the expression, and attach the number value of the slider to those positions – But I also need it to interpolate between those keyframes, and I’m not certain it would automatically do that.

    Thanks!

    Kalleheikki Kannisto replied 7 years ago 3 Members · 2 Replies
  • 2 Replies
  • Griffin Englander

    April 23, 2019 at 11:41 pm

    Hey Benjamin,

    If you pre-comp your transitions between your frames, then add markers to each final position (ie. page1, 2 etc)

    Then in your main comp, apply those markers to your PreComp (Just add a layer marker, right click and select ‘Update Markers From Source’).
    Then, add your slider, and add the below expression to TimeRemapping, and repeat the pattern until you get your 12.

    Just make sure your last value in if else (what’s 5.001 in this example) is anything higher than 12, otherwise it might break.
    NB. this expression has the Slider starting on 1. So 1 for page/frame 1.

    Does this make any sense? Apologies for the messy expression.

    s = effect("Slider Control")("Slider");
    p1 = thisLayer.marker.key("Page1");
    p2 = thisLayer.marker.key("Page2");
    p3 = thisLayer.marker.key("Page3");
    p4 = thisLayer.marker.key("Page4");
    p5 = thisLayer.makrer.key("Page5");
    L1 = linear(s,1,2,p1.time,p2.time);
    L2 = linear(s,2,3,p2.time,p3.time);
    L3 = linear(s,3,4,p3.time,p4.time);
    L4 = linear(s,4,5,p4.time,p5.time);
    if (s > 0.999 && s <1.999) {L1
    } else if (s>1.999 && s<2.999) {L2
    } else if (s>2.999 && s<3.999) {L3
    } else if (s>3.999 && s<5.001){L4
    }

  • Kalleheikki Kannisto

    April 27, 2019 at 11:05 am

    Did you get this sorted out?

    Kalleheikki Kannisto
    Senior Graphic Designer

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