class Hanoi::Jane::Smoosher

Attributes

animtype[R]
direction[RW]

Public Class Methods

new() { |self| ... } click to toggle source
# File lib/hanoi/jane/animation/smoosher.rb, line 9
def initialize
  @direction = :close
  @step = 0.05
  @animtype = :tween

  yield self if block_given?
end
row(weight = 0) click to toggle source
# File lib/hanoi/jane/animation/smoosher.rb, line 36
def Smoosher.row weight = 0
  a = []
  45.times do
    a.push (weight > Random.rand) ? 1 : 0
  end
  a
end

Public Instance Methods

each() { |self| ... } click to toggle source
# File lib/hanoi/jane/animation/smoosher.rb, line 17
def each
  @range = (0..1).step(0.05).to_a
  @range.reverse! if @direction == :open
  @range.each do |weight|
    populate weight
    yield self
  end
end
populate(weight) click to toggle source
# File lib/hanoi/jane/animation/smoosher.rb, line 26
def populate weight
  7.times do |i|
    self[i] = Smoosher.row weight
  end
end
to_dots() click to toggle source
# File lib/hanoi/jane/animation/smoosher.rb, line 32
def to_dots
  self
end