Module: Gemwarrior::Animation

Defined in:
lib/gemwarrior/misc/animation.rb

Class Method Summary collapse

Class Method Details

.run(opts) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gemwarrior/misc/animation.rb', line 6

def self.run(opts)
  options = {
    oneline:    false, 
    speed:      nil, 
    alpha:      true, 
    numeric:    true, 
    random:     true,
    color:      nil,
    background: nil
  }.merge(opts)

  th = Thread.new do
    print Matrext.process({
      phrase:     options.fetch(:phrase),
      oneline:    options.fetch(:oneline),
      speed:      options.fetch(:speed),
      alpha:      options.fetch(:alpha),
      numeric:    options.fetch(:numeric),
      random:     options.fetch(:random),
      color:      options.fetch(:color),
      background: options.fetch(:background)
    })
  end

  return th.join
end