Nanoprogrammed Penultimate Musicianship
Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

glsl-range

1.0.0 • Public • Published

glsl-range stable

The opposite of mix in GLSL: pass in a min/max/actual value and recieve a range value describing how far the actual is between min and max.

Another way to describe it would be:

c == mix(a, b, t);
t == range(a, b, c);

Usage

NPM

float range(float min, float max, float value)

vec2 range(vec2 min, vec2 max, vec2 value)

vec3 range(vec3 min, vec3 max, vec3 value)

vec4 range(vec4 min, vec4 max, vec4 value)

Returns how far a value is between min and max. For example:

  • If value is equal to min, you'll get 0.0 in return.
  • If value is equal to max, you'll get 1.0 in return.
  • If value is halfway between min and max, you'll get 0.5 in return.

License

MIT. See LICENSE.md for details.

install

npm i glsl-range

Downloadsweekly downloads

1

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability