Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to make number values change according to slider

  • How to make number values change according to slider

    Posted by Mathias Kalhauge on March 5, 2018 at 1:42 pm

    Hey, so I’m in the middle of a project where I need numbers from 0 to 100 to change with a slider.
    I’ve made a slider consisting of shapes. I’ve parrented a Null Object to the shape that will be moving, so I need the expression to change according to the position of the Null Object.
    So when the Null Object is in the bottom the number says 0, and when the Null Object is in the top the number says 100.
    I know this isn’t the best explanation, but I hope it’s understandable.

    Andrei Popa replied 8 years, 2 months ago 2 Members · 1 Reply
  • 1 Reply
  • Andrei Popa

    March 6, 2018 at 2:19 pm

    Try this.
    layerPosition = thisComp.layer("Null 1").transform.position[1]; //here you put 1 for the y position or 0 for the x position. That depends on how you want to move your null(vertically/horizontally)
    botValue = 100;//the value of the position of the null where you want your value to be 0
    topValue = 800;//the value of the position of the null where you want your value to be 100
    numValue =Math.floor( ( (layerPosition-botValue) / (topValue-botValue) ) * 100)
    numValue

    Andrei
    My Envato portfolio.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy