I'm trying to create a function that uses percentage to get a number. The idea is to have something like this: 0%: 100px 50%: 200px 75%: 210px
So when I run my function at a percentage like 25% it blends 0 and 50 together, same for above 50%.
It sounds kind of complicated, the overall idea is to create something using JS only that will ease the numbers going from 0 to 100%
I've tried using regular percentage calculation, yet it doesn't really work for 3 or more variables.
So if you don't mind I've taken the liberty of turning your percentage into a JSON object:
We can then do something like this if we assume percentages are always whole numbers:
this outputs something along the lines of:
Let me know if you need any clarification.
Note: comments are made in code