ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Create an expression for a multi position slider control

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Danny Ratcliff
Create an expression for a multi position slider control
on Jan 3, 2019 at 6:40:08 pm

Very long time listener, first time caller.

I've been able to cobble together expressions with the help of Dan, Rick, Myllenium and others over the years and never had to darken your doors with a question, but I'm stuck with something (seemingly) incredibly simple that despite countless hours of searching, I haven't been able to find an answer to.

I'm trying to write an expression that will link multiple layers to a slider on a controlling null object. The slider will have values between 1 and 5, each corresponding to a different X, Y coordinate.

Somehow in my years of searching and frankensteining expressions together, I've never learned to do this. Any help would be very much appreciated. Apologies if this is embarrassingly simple!!


Return to posts index

Dan Ebberts
Re: Create an expression for a multi position slider control
on Jan 3, 2019 at 8:06:43 pm

Each of the layers will need its own position expression, something like this:

s = thisComp.layer("control").effect("Slider Control")("Slider").value;
points = [[0,0],[100,100],[200,200],[300,300],[400,400]];
idx = clamp(s-1,0,points.length-1);
points[idx]


Dan



Return to posts index

Danny Ratcliff
Re: Create an expression for a multi position slider control
on Jan 3, 2019 at 9:41:29 pm

Thank you so much for this Dan, I really appreciate it. You've unknowingly helped me out countless times over the years!!

Happy New year!!

Danny


Return to posts index

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