module Phlox::GradientGen

Public Class Methods

gen_gradient() click to toggle source

Create a Proc that calculates an [r, g, b] triple for given [x, y] coordinates based on randomly-generated calculation functions.

# File lib/phlox/gradient_gen.rb, line 5
def self.gen_gradient
  r, g, b = Node.new, Node.new, Node.new

  Proc.new do |x, y|
    [r.run(x, y) % 255,
     g.run(x, y) % 255,
     b.run(x, y) % 255]
  end
end