ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Benjamin Arthur
Slider to shift layer between 12 possible x/y 2D positions
on Apr 23, 2019 at 7:13:40 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!


Return to posts index

Griffin Englander
Re: Slider to shift layer between 12 possible x/y 2D positions
on Apr 23, 2019 at 11:41:35 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 &lt;1.999) {L1
} else if (s>1.999 && s&lt;2.999) {L2
} else if (s>2.999 && s&lt;3.999) {L3
} else if (s>3.999 && s&lt;5.001){L4
}


Return to posts index

Kalleheikki Kannisto
Re: Slider to shift layer between 12 possible x/y 2D positions
on Apr 27, 2019 at 11:05:32 am

Did you get this sorted out?

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]