Advertisement
KoctrX

Untitled

Jun 8th, 2023
987
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. conv(val, slope_min = 0, slope_max = 1) {
  2.             val = val / 100;
  3.             const r = ((slope_max * (val)) - (slope_min * (val)) - (slope_min * -1)).toFixed(8);
  4.             return Number(r);
  5.         },
  6.  
  7.         reverseConv(val, min, max) {
  8.             return ((val - min) / (max - min)) * 100;
  9.         },
  10.  
  11.         convRange(value, realMin, realMax, min, max, isReverse = false) {
  12.             if (isReverse) {
  13.                 return _LIB.lib.conv((((value - realMin) / (realMax - realMin)) * 100), min, max);
  14.             }
  15.  
  16.             return _LIB.lib.conv((((value - realMin) / (realMax - realMin)) * 100), min, max);
  17.         },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement