Sha256: 452d44b45ee6e1a689756c133e201b87b28d33f1fb68cd71d8f30dc53c6404e2
Contents?: true
Size: 811 Bytes
Versions: 3
Compression:
Stored size: 811 Bytes
Contents
module Hanoi module Jane class Smoosher < Array include Enumerable attr_accessor :direction attr_reader :animtype def initialize @direction = :close @step = 0.05 @animtype = :tween yield self if block_given? end 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 def populate weight 7.times do |i| self[i] = Smoosher.row weight end end def to_dots self end def Smoosher.row weight = 0 a = [] 45.times do a.push (weight > Random.rand) ? 1 : 0 end a end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanoi-jane-0.4.0 | lib/hanoi/jane/animation/smoosher.rb |
hanoi-jane-0.3.4 | lib/hanoi/jane/animation/smoosher.rb |
hanoi-jane-0.3.3 | lib/hanoi/jane/animation/smoosher.rb |