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

Flipping Y axis (up is positive)

New Here ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

Hello everyone, 

 

I have a problem and after led some research, seems i can't find the answer in this forum.

I created a graphic with a sphere, and its position is linked to the maskpath of the curve.

 

On my text layer, I've added en expression on the sourcetext, so the text display only the Y position as the sphere is sliding over the curve. 

Question : When the sphere is going up I'd like the info shows a positive number !  (Like if I wanted that the top and right area of the screen starting from the middle has a positive value. which seems more logical if the position of the sphere is increasing and so display a higher value !) 

 

Thanks you very much for your help01.JPG02.JPG

 

TOPICS
Expressions , How to

Views

272

Translate

Translate

Report

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 , Jan 29, 2021 Jan 29, 2021

I would use the linear interpolation method from the Expression Language menu in the timeline to drive the text layer:  linear(t, tMin, tMax, value1, value2) 

 

All you have to do is define t as the Y value of your indicator ("Orange uni 1") and set tMin and tMax and the minimum and maximum Y value for the graph. Then you assign value1 as the highest value or top of the graph, and value2 as the lowest. This will convert your y position value into the numbers you need to properly display the valu

...

Votes

Translate

Translate
LEGEND ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

Nothing but basic math: You subtract the position of your baseline and multiply with -1 if need be.

 

Mylenium

Votes

Translate

Translate

Report

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
New Here ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

I think so yes, but sorry could you please write the expression for me ? 

I've tried different way to write the expression but dont know exaclty where to insert the minus^^

Votes

Translate

Translate

Report

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 ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

LATEST

I would use the linear interpolation method from the Expression Language menu in the timeline to drive the text layer:  linear(t, tMin, tMax, value1, value2) 

 

All you have to do is define t as the Y value of your indicator ("Orange uni 1") and set tMin and tMax and the minimum and maximum Y value for the graph. Then you assign value1 as the highest value or top of the graph, and value2 as the lowest. This will convert your y position value into the numbers you need to properly display the values in the graph.  Adding toFixed(1) to the end of the linear interpolation method completes the expression.

 

If the graph was 900 pixels tall and the top line was at 100 and the bottom was at 1000 and the scale of the graph was from zero to 500 then this would be the expression:

t = thisComp.layer("Orange uni 1").transform.position[1];
tMin = 1000;// Y value for the bottom of the graph
tMax = 100; // Y value for the top of the graph
value1 = 500; // highest value for graph
value2 = 0; // lowest value for graph
linear(t, tMin, tMax, value1, value2).toFixed(1);

 A radial display like a speedometer might be an easier way to view the data. Changing numbers can be hard to read. You would just modify the expression to drive the rotation of a pointer like this:

t = thisComp.layer("Orange uni 1").transform.position[1];
tMin = 1000;// Y value for the bottom of the graph
tMax = 100; // Y value for the top of the graph
value1 = 140; // counter clockwise angle
value2 = -140; // clockwise angle
linear(t, tMin, tMax, value1, value2).toFixed(1);

And you can end up with something like this in about 10 minutes:

Graph Example.png

Votes

Translate

Translate

Report

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