Skip to main content
Participant
October 31, 2018
Answered

After Effect Expression percent of a position.

  • October 31, 2018
  • 1 reply
  • 3902 views

Hello,

I make a layer and it wiggles on the y axis. Next to the layer is a text and i want to show the percent of the position of the y axis from the layer.

So if the position is 21,0 show 0 %

Is the position 597,0 show 100%

And I need the percent between the 0% and 100%

I make this:

Math.round(length(thisComp.layer("Position2").transform.position, thisComp.layer("Position1").transform.position))

But it shows the value of the position.

Anyone a idea to create the expression or a have a link to the answer i be thankful, I google for 1 hour and i found nothing.

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

I'm not sure if this is what you're after, but maybe something like this:

y = thisComp.layer("Position 2").transform.position[1];

linear(y,21,597,0,100)

Dan

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
October 31, 2018

I'm not sure if this is what you're after, but maybe something like this:

y = thisComp.layer("Position 2").transform.position[1];

linear(y,21,597,0,100)

Dan

Participant
October 31, 2018

Thank you that was i am looking for