Sha256: a234335929064055b8ea1a5608fabf97cd622fa82471fb97dff6938da253dcb2

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

#!/usr/bin/env ruby
require_relative './bootstrap'
require 'optparse'

class Animate < Tatty::Stage
  def initialize(animation:)
    super()
    @animation = animation
  end

  def keypress(event)
    exit if event.value == "q" || event.value == "\e" || event.value == "x"
  end

  def draw
    done = @animation.step
    @animation.reset if !@animation.loop and done
    render_at(0, 0, @animation.display)
  end
end

filepath = ARGV[0]
name = ARGV[1] || :default
animation = Tatty::Anim.from_atlas(filepath, name: name)
if animation.nil?
  puts "Cannot find animation '#{name}'"
else
  Tatty.run(Animate, animation: animation)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
petli-0.0.4 bin/anim