Skip to content

Commit

Permalink
Three-stripe sky background.
Browse files Browse the repository at this point in the history
  • Loading branch information
pda committed Jan 15, 2012
1 parent 87c146e commit c463e52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions asc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ def to_s
end

class Background
PALETTE = [ 16, 232 ]
PALETTE = [ 16, 232, 233 ]
PERIOD = 5.0
SPEED = 10.0
def pixel x, y, char = ":"
Pixel.new char, 0, color(x, y)
end
def color x, y
sin = Math.sin((x + Time.new.to_f * SPEED) / PERIOD + y / PERIOD)
PALETTE[(0.5 * sin + 0.5).round]
PALETTE[(0.9 * sin + 0.9).round]
end
end

Expand Down

0 comments on commit c463e52

Please sign in to comment.