I have a progress bar in a website that needs to be filled based on the number $50$. So at $50$ it will be $100\%$ full. The problem is that it starts at about $20\%$ then follows this pattern :
for the number $5$ it should be $31\%$ full
for the number $10$ it should be $52\%$ full
for the number $25$ it should be $72\%$ full
Moreover, on the way from $5$ to $10$ it should move toward the $52\%$ mark from $31\%$ mark but only reach that number when we get to the required number $10$. The same goes for $52\%$ to $72\%$ and then from $25$ to $50$ it should slowly creep toward $100\%$ from $72\%$
I have tried using a bunch of if statements with different percentages and additions to get there, but nothing seems to be working. A single algorithm would be great!
Thanks!
If you want to have your progress bar grow linear between 5 and 10, 10 and 25, 25 and 50, then something like this would do it:
(the formulas above for the calulation of the percentages can be found by solving a linear system)