FORUMS: list search recent posts

Translating X position data to -100 to 100 slider range

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Vanessa Appleby
Translating X position data to -100 to 100 slider range
on Nov 7, 2015 at 7:22:36 pm

I have a slider (actual artwork that is a slider) that is part of a graph. It needs to be controlled by an expression control slider with value range of -100 to +100 (-100 is the far left of the slider art, +100 is far right). here's a picture

The triangle needs to move across the slider as the value changes. Super simple.

I can't figure out how to translate the position values of the start and the end points to the -100 to 100 value range of the expression slider. In this comp the start X position value is 0, and the end value is 800. So somehow I need to define the following:

-100 (slider range) = 0 (x position)
+100 (slider range) = 800 (x position)

This is probably simple math, but well, I never paid much attention in math class- too busy drawing! Any help would be GREATLY appreciated. Thanks!


Return to posts index

Dan Ebberts
Re: Translating X position data to -100 to 100 slider range
on Nov 7, 2015 at 7:28:18 pm

It should be something like this:

s = (your slider reference here);
x = linear(s,-100,100,0,800);
[x,value[1]]


Dan



Return to posts index

Vanessa Appleby
Re: Translating X position data to -100 to 100 slider range
on Nov 7, 2015 at 7:44:30 pm

YOU ARE A GENIUS! This works perfectly! Thanks soooo much!


Return to posts index


Vanessa Appleby
Re: Translating X position data to -100 to 100 slider range
on Nov 7, 2015 at 7:57:05 pm
Last Edited By Vanessa Appleby on Nov 7, 2015 at 8:04:10 pm

Nevermind. I got it. here it is for Y in case anyone else needs this:

s = thisComp.layer("VALUES").effect("Value1")("Slider");
y = linear(s,-100,100,0,800);
[value[1],y]


Return to posts index

Dan Ebberts
Re: Translating X position data to -100 to 100 slider range
on Nov 7, 2015 at 8:01:12 pm

try changing the last line to:

[value[0],y]

Dan



Return to posts index

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