CabinGame/Luxe/math/math.wren

17 lines
335 B
Text
Raw Normal View History

2020-08-16 13:59:43 +00:00
class M{
static inv_lerp(from, to, inter){
return (inter - from) / (to - from)
}
static lerp(from, to, value){
return from + value * (to - from)
}
static remap(min_in, max_in, min_out, max_out, value){
var inter = inv_lerp(min_in, max_in, value)
return lerp(min_out, max_out, inter)
}
}