Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can't get slider to read speedometer values without it graying out. (Slider control expression help)

Guest
May 27, 2021 May 27, 2021

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.
without slider value expression..PNG

 

After this I pulled the slider up to full 140 value and found that it reaches half way through the gauge only reading 70.

 

no slider expression value full.PNG

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.

slider expresion added full value.PNG

 

Although the value shows 280, when I click on the number it will show the correct value.

Clicking slider.png

 

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.

TOPICS
Error or problem , Expressions , How to , Scripting
811
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 27, 2021 May 27, 2021

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. 

 

  1. Make sure that the needle layer's anchor point is in the right place
  2. Rotate the needle layer (Layer 3) to the Zero position on the dial and note the starting value which appears to be -140º and make note of the value.
  3. Rotate the needle layer to the maximum va
...
Translate
Guest
May 27, 2021 May 27, 2021

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 27, 2021 May 27, 2021

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. 

 

  1. Make sure that the needle layer's anchor point is in the right place
  2. Rotate the needle layer (Layer 3) to the Zero position on the dial and note the starting value which appears to be -140º and make note of the value.
  3. Rotate the needle layer to the maximum value on the dial which appears to be 140º and make note of the value.
  4. Get rid of the expression on the slider control. It is not needed
  5. Use the linear method to convert the slider value of 0 to 140 to an angle change from - 140 to 140 by adding this expression to the Needle/Transform/Rotation property:
t = thisComp.layer("Null 1").effect("Slider Control")("Slider");
linear(t, 0, 140, -140, 140)

That's all there is to it. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 27, 2021 May 27, 2021

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.




 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 27, 2021 May 27, 2021

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 27, 2021 May 27, 2021
LATEST

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines