Class: WindowColor

Inherits:
Object
  • Object
show all
Defined in:
lib/rofltim.rb

Constant Summary collapse

PALETTE =
[ 16, 60 ]
PERIOD =
6.0

Instance Method Summary collapse

Instance Method Details

#color(x, y) ⇒ Object



137
138
139
140
# File 'lib/rofltim.rb', line 137

def color x, y
  sin = Math.sin(x / PERIOD + y / (PERIOD * 0.5))
  PALETTE[(0.256 * sin + 0.256).round]
end

#pixel(x, y, char = " ") ⇒ Object



134
135
136
# File 'lib/rofltim.rb', line 134

def pixel x, y, char = " "
  Pixel.new char, 0, color(x, y)
end