Well, for starters, we need to build a good schedule to better understand what function we're looking for. You've got him on the picture, he's staggered, and he's actually growing up smoothly. There is clearly a degree between 0 and 1 (reminder: square root is 0.5 degree). If the type of function has already been defined, its coefficients shall remain. There is. http://mathprofi.ru/metod_naimenshih_kvadratov.html but it's very embarrassing with him (and if you do, it'll still be a good approach, not a real function).It is often easier to obtain manual coefficients. Especially if it's RPG play data, where slaves like to make up all the tricky things: It's not the fact that it all comes out of one formula.It would be good to make a tool that would paint and count quickly. It's a good thing to organize here. https://liveweave.com/ Changes are displayed instantly. A little played there.if (процент > 25) {
y = 1061184077 + (1072693248 - 1061184077) * ((процент / 100) ** 0.15);
} else if (процент > 5) {
y = 1061184077 + (1072693248 - 1061184077) * ((процент / 120) ** 0.195) / 0.90;
} else {
y = 1061184077 + (1072693248 - 1061184077) * процент ** 0.35 / 3;
}
console.clear();
(function() {
let data = getData();
let canvas = document.getElementById('canvas');
let ctx = canvas.getContext('2d');
window.onresize = draw;
draw();
function draw() {
let vw = canvas.width = window.innerWidth - 30;
let vh = canvas.height = window.innerHeight - 20;
real_data();
attempt();
function real_data() {
ctx.fillStyle = "blue";
data.forEach(function(p) {
let cx = vw * p[0] / 100;
let cy = vh - vh * (p[1] - 1061184077) / (1072693248 - 1061184077);
point(cx, cy, 5);
});
}
function attempt() {
ctx.fillStyle = "orange";
data.forEach(function(p) {
let cx = vw * p[0] / 100;
let y;
if (p[0] > 25) {
y = 1061184077 + (1072693248 - 1061184077) * ((p[0] / 100) ** 0.15);
} else if (p[0] > 5) {
y = 1061184077 + (1072693248 - 1061184077) * ((p[0] / 120) ** 0.195) / 0.90;
} else {
y = 1061184077 + (1072693248 - 1061184077) * p[0] ** 0.35 / 3;
}
let cy = vh - vh * (y - 1061184077) / (1072693248 - 1061184077);
point(cx, cy, 3);
});
}
}
function point(cx, cy, r = 2) {
ctx.beginPath();
ctx.arc(cx, cy, r, 0, 2 * Math.PI);
ctx.fill();
}
function getData() {
return [
[100, 1072693248],
[99.9, 1072692198],
[99.8, 1072690101],
[99.7, 1072688004],
[99.6, 1072685906],
[99.5, 1072683810],
[99.4, 1072681713],
[99.3, 1072679616],
[99.2, 1072677519],
[99.1, 1072675421],
[99.0, 1072673324],
[98.9, 1072671227],
[98.8, 1072669130],
[98.7, 1072667032],
[98.6, 1072664935],
[98.5, 1072662838],
[98.4, 1072660741],
[98.3, 1072658644],
[98.2, 1072656547],
[98.1, 1072654450],
[98.0, 1072652353],
[97.9, 1072650256],
[97.8, 1072648159],
[97.7, 1072646062],
[97.6, 1072643964],
[97.5, 1072641867],
[97.4, 1072639770],
[97.3, 1072637673],
[97.2, 1072635576],
[97.1, 1072633479],
[97.0, 1072631381],
[90.0, 1072484580],
[89.9, 1072482483],
[75.0, 1072170008],
[74.9, 1072167911],
[70.0, 1072065150],
[69.9, 1072063052],
[65.0, 1071960292],
[64.9, 1071958195],
[60.0, 1071855435],
[59.9, 1071853337],
[55.0, 1071750577],
[54.9, 1071748480],
[50.0, 1071645720],
[49.9, 1071642574],
[35.0, 1071017623],
[34.9, 1071013428],
[40.0, 1071227338],
[39.9, 1071223143],
[30.0, 1070807907],
[29.9, 1070803714],
[25.0, 1070598192],
[24.9, 1070591901],
[20.0, 1070180859],
[19.9, 1070172470],
[15.0, 1069761429],
[14.9, 1069753039],
[10.0, 1069136477],
[9.9, 1069119700],
[9.8, 1069102923],
[9.7, 1069086146],
[9.6, 1069069369],
[9.5, 1069052591],
[9.4, 1069035814],
[9.3, 1069019037],
[9.2, 1069002260],
[9.1, 1068985482],
[9.0, 1068968705],
[5.0, 1068096289],
[4.9, 1068062735],
[1.0, 1065713925],
[0.9, 1065579708],
[0.2, 1063549664],
[0.1, 1062769523],
[0.0, 1061184077],
];
}
})();canvas {
border: 1px solid red;
}<canvas id="canvas"></canvas>(the blue points are derived from real data, orange from the formula)