Copy link to clipboard
Copied
Hello! I would like for a speedometer gauge I'm working on to be attached to a slider and for the slider values to read the values of the gauge instead of the degrees of rotation.
After creating the gauge I put in the following expression to make it start at the zero point on the gauge:
startPoint=thisComp.layer("Null 1").effect("Slider Control")("Slider")-140
This seemed to work. I was happy with it. I also limited the slider to 140 because this is the limit of the gauge itself.
After this I pulled the slider up to full 140 value and found that it reaches half way through the gauge only reading 70.
I knew the rotation rate wouldn't match the gauge at first so I started looking for a solution to this problem. I came up with this expression to try and solve the issue. I pasted it in the "Slider" because I don't know how to make it work from the Needle layer.
I put the following:
sliderValueTransform=value/.5
This solved the issue of alignment. the gauge now lines up with the value I plug into the slider. But the slider is greyed out and cannot be used save for clicking the underlined value in the picture.
Although the value shows 280, when I click on the number it will show the correct value.
I'm in that place of almost solving my issue, but I can't seem to have my cake and eat it. I would like the slider to be not greyed out and still be lined up with the gauge. A bonus would be for the slider to read the correct value (140 istead of 280) but I'm more concerned with the slider being functional.
I have other questions like how to make the slider not go under 0 or over 140 but I think this is the more important issue. Any help I can get is appreciated.
Your approach is flawed. You are controlling the angle of the pointer with the slider so you need to convert the total rotation angle of the pointer to the range of the values. The linear method is what is required. Here's the workflow.
Copy link to clipboard
Copied
I forgot to mention that any expression I place in the slider makes it grey out. So I'm assuming that I will need to make an expression from the Needle layer for the slider to work properly?
Copy link to clipboard
Copied
Your approach is flawed. You are controlling the angle of the pointer with the slider so you need to convert the total rotation angle of the pointer to the range of the values. The linear method is what is required. Here's the workflow.
t = thisComp.layer("Null 1").effect("Slider Control")("Slider");
linear(t, 0, 140, -140, 140)
That's all there is to it.
Copy link to clipboard
Copied
Oh man haha. You made it look so easy. Thank you so much!
So excuse me if I show my inexperience in this matter but I really want to understand the expression as well as use it.
T is the variable you are creating. You're saying T is equal to the slider control yes?
then the second line is confusing.
What are you telling AE if you say Linear?
I can generally understand maybe you are setting boundaries of some sort with 0,140 and -140 and 140. but why is T there?
I appreciate the help.
Copy link to clipboard
Copied
In the Expression Language menu, there are several methods of interpolation. Linear is just one. The expression looks like this if you let the Expression Language menu write it:
linear(t, tMin, tMax, value1, value2)
the only reason that I used t as a variable to assign to the slider control is that it saves me typing and makes it easier to understand what the expression is doing.
The expression basically says this: Convert the minimum value of "t" to value1, and convert the maximum (tMax) of "t" to value 2, and interpolate between those values in a linear way.
That's it. All of this info is in the expression language menu. Interpolation is one of the most used calculations in any motion graphics application. They all, from Nuke to Fusion, to 3DS Max, to After Effects have interpolation methods available.
Copy link to clipboard
Copied
I appreciate the time you took to explain this to me! I understand now. I will be playing around with the menu more in the future for sure. Thanks for the help again!