class Graphics::Rainbow
Creates a range of colors all at once. See initialize_rainbow.
Public Instance Methods
scale(d, min, max)
click to toggle source
Takes a value and a range, and scales that range to 0-360
# File lib/graphics/rainbows.rb, line 18 def scale d, min, max range = max - min if range != 0 scaled = (d.to_f / range) * 360 return clamp(scaled, 0, 360).round else 0 end end