MCPcopy
hub / github.com/pterm/pterm / MapRangeToRange

Function MapRangeToRange

internal/map_range_to_range.go:3–8  ·  view source on GitHub ↗
(fromMin, fromMax, toMin, toMax, current float32)

Source from the content-addressed store, hash-verified

1package internal
2
3func MapRangeToRange(fromMin, fromMax, toMin, toMax, current float32) int {
4 if fromMax-fromMin == 0 {
5 return 0
6 }
7 return int(toMin + ((toMax-toMin)/(fromMax-fromMin))*(current-fromMin))
8}

Callers 3

SrenderMethod · 0.92
FadeMethod · 0.92
TestMapRangeToRangeFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestMapRangeToRangeFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…