Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #outputs an array of length n, where the first elelemtn is pure colour_a, the last element
- #is pure colour_b, and every other element is a linear interpolation between the two
- def gen_colour_array(colour_a, colour_b, n)
- (1..n).map{|x| x / n.to_f}.map{|c| color_lerp colour_a, colour_b, c}
- end
- #a 19 colour array that granually goes from green, to yellow, to red
- @colours = (gen_colour_array GREEN, YELLOW, 10) | (gen_colour_array YELLOW, RED, 10)
Add Comment
Please, Sign In to add comment