Method: Processing::GraphicsContext#map

Defined in:
lib/processing/graphics_context.rb

#map(value, start1, stop1, start2, stop2) ⇒ Numeric

Maps a number from range start1..stop1 to range start2..stop2.

Parameters:

  • value (Numeric)

    number to be mapped

  • start1 (Numeric)

    lower bound of the range1

  • stop1 (Numeric)

    upper bound of the range1

  • start2 (Numeric)

    lower bound of the range2

  • stop2 (Numeric)

    upper bound of the range2

Returns:

  • (Numeric)

    mapped number



1410
1411
1412
# File 'lib/processing/graphics_context.rb', line 1410

def map(value, start1, stop1, start2, stop2)
  lerp start2, stop2, norm(value, start1, stop1)
end