Module: Phlox::GradientGen

Defined in:
lib/phlox/gradient_gen.rb

Defined Under Namespace

Classes: Node

Class Method Summary collapse

Class Method Details

.gen_gradientObject

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



5
6
7
8
9
10
11
12
13
# 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