ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Translating Y-coordinates into a numbered value corresponding with a graph

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Øystein Rambjør Holten
Translating Y-coordinates into a numbered value corresponding with a graph
on Aug 21, 2018 at 5:53:59 pm

Hi there!

I'm currently working on an animated line graph in After Effects, made based on a JSON-file applied to a path linked to several Null Objects.

My problem now is that I want a number counter that follows the graph as its being "drawn" - which is already done - and also displays a value corresponding with its position on the graph.

So I'm in need of an expression that can translate the Y-coordinates of the Null that's linked to the graph animation -within a min/max range of 0 to 14,000,000,000, where the baseline of the comp lies at 974 pixels and a max_movement of -865 - into a numerical value that corresponds with the position on the graph.
As of right now, I just have an empty text layer with its position and content linked to the position of a null.



Do you guys have any ideas on how I might solve this? It's my first foray into the world of expressions, so I'm not experienced at all with this...


Return to posts index

Dan Ebberts
Re: Translating Y-coordinates into a numbered value corresponding with a graph
on Aug 21, 2018 at 7:52:23 pm

Something similar to this maybe:

L = thisComp.layer("Null 1");
y = L.toComp(L.anchorPoint)[1];
Math.round(linear(y,109,865,14000000000,0))


Dan



Return to posts index

Øystein Rambjør Holten
Re: Translating Y-coordinates into a numbered value corresponding with a graph
on Aug 22, 2018 at 2:39:32 pm

Thank you so much!

It worked, but the data scale didn't translate well due to the size...
But it'll definitely come in handy on future projects, where I'll make sure to retrieve spreadsheets with fewer data points and, hopefully, not such high numbers 😅


Return to posts index

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