Class: Asciimation::DropAnimator

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

Instance Method Summary collapse

Constructor Details

#initialize(io:, options:) ⇒ DropAnimator

Returns a new instance of DropAnimator.



3
4
5
6
# File 'lib/asciimation/drop_animator.rb', line 3

def initialize(io: , options: )
  @io      = io
  @options = options
end

Instance Method Details

#animate(screen) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/asciimation/drop_animator.rb', line 11

def animate(screen)
  lines.each_with_index.reverse_each do |line, i|
    (i + 1 + top_lines(screen)).times do |y|
      draw_line(screen, " " * line.size, y - 1) unless y.zero?
      draw_line(screen, line,            y)
      redraw(screen)
      wait(screen)
    end
  end
end