glsl-scale-linear

1.0.0 • Public • Published

glsl-scale-linear

stable

A linear scale for glslify.

Usage

NPM

scale(float value, vec2 domain)

Returns a value between 0 and 1, depending on where along the scale value lies between domain.x (min) and domain.y (max).

#pragma glslify: scale require('glsl-scale-linear') 
 
float min   = 0.0;
float max   = 1000.0;
float value = 100.0;
 
float t = scale(value, vec2(minmax));

scale(float value, vec2 domain, vec2 range)

Similar to the above signature, however returns a value between range.x and range.y instead of 0 and 1. Shorthand for mix(range.x, range.y, scale(...)).

float t = scale(value, vec2(minmax), vec2(0.01.0));

Contributing

See stackgl/contributing for details.

License

MIT. See LICENSE.md for details.

Package Sidebar

Install

npm i glsl-scale-linear

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • dy
  • archmoj
  • hughsk
  • mikolalysenko
  • substack
  • mattdesl
  • chrisdickinson
  • yoshuawuyts
  • mikkoh
  • rezaali
  • tatumcreative
  • wwwtyro
  • thibauts
  • bpostlethwaite
  • dfcreative
  • erkaman
  • gre
  • rreusser
  • vorg