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.
Try this. layerPosition = thisComp.layer("Null 1").transform.position; //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)