I have a function that linearly transforms ratio to a value within a range:
function translateRatio(ratio: number, min: number, max: number): number
{
return (max - min) * ratio + min;
}
Where ratio is in the [0, 1] range. Example:
Given:
ratio = 0.5
min = 0
max = 90
Result would be 45
I need help adding feature to this function where given two cubic-bezier control points, the transformation from the ratio to the range would not be linear, but instead would be based on the bezier curve interpolated with help of the two control points. Much like in this tool.
The resulting signature of that function would look like so:
(ratio, min, max, minB1, minB2, maxB1, maxB2) => valueInMinMaxRange
Where minB1, minB2, maxB1 and maxB2 are all in the range of [0, 1]
Please feel free to fix my terminology. I don't have a good math background.