Skip to main content
Participant
February 17, 2023
Answered

Move an object within a limited range of an axis using a slider.

  • February 17, 2023
  • 2 replies
  • 592 views

Hi, I am trying to move an object within a limited range of an axis. for example: Minimum Range = [50, 540]; Range Max= [1000, 540]; I look for it to move within this range by moving a slider with a value from 0 to 100. Try doing the following:

minVal = [50, 540];
maxVal = [900, 540];
if (thisComp.layer("Adjustment Layer 1").effect("Slider Control"), minVal, maxVal)

I know maybe I'm very lost, I would really appreciate the help.

This topic has been closed for replies.
Correct answer Dan Ebberts

Probably like this:

minVal = [50,540];
maxVal = [900,540];
s = thisComp.layer("Adjustment Layer 1").effect("Slider Control")("Slider");
linear(s,0,100,minVal,maxVal)

2 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
February 18, 2023

Probably like this:

minVal = [50,540];
maxVal = [900,540];
s = thisComp.layer("Adjustment Layer 1").effect("Slider Control")("Slider");
linear(s,0,100,minVal,maxVal)
Participant
February 22, 2023

It works perfect! thank you so much!

Mylenium
Legend
February 18, 2023

mSlider=thisComp.layer("XYZ").effect("Slider");

 

minVal = [50, 540];
maxVal = [900, 540];

 

X=linear(mSlider,0,100,minVal[0];maxVal[0]);

Y=linear(mSlider,0,100,minVal[1];maxVal[1]);

 

[X,Y]

 

Mylenium