Guest User

Untitled

a guest
Feb 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #outputs an array of length n, where the first elelemtn is pure colour_a, the last element
  2. #is pure colour_b, and every other element is a linear interpolation between the two
  3. def gen_colour_array(colour_a, colour_b, n)
  4. (1..n).map{|x| x / n.to_f}.map{|c| color_lerp colour_a, colour_b, c}
  5. end
  6.  
  7. #a 19 colour array that granually goes from green, to yellow, to red
  8. @colours = (gen_colour_array GREEN, YELLOW, 10) | (gen_colour_array YELLOW, RED, 10)
Add Comment
Please, Sign In to add comment