Sha256: e11f67cbd7138a8b6ffd8e0a3eb61ae82fa4896c48f9cfe93ebf8b9d18f32e87

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

require "RMagick"
class Gifanime
  attr_accessor :frames, :delay, :iterations, :scene, :ticks_per_secound, :outputfile

  def initialize(outputfile, options = {})
    @delay             = options[:delay]
    @iterations        = options[:iterations]
    @scene             = options[:scene]
    @ticks_per_secound = options[:ticks_per_secound]
    outputfile = outputfile + ".gif" unless outputfile =~ /\.gif\z/
    @outputfile        = outputfile
    @frames = []
  end

  def add(frame)
    frames << frame
  end

  def generate!
    gif = ::Magick::ImageList.new(*frames)
    gif.delay = delay if delay
    gif.iterations = iterations if iterations
    gif.scene = scene if scene
    gif.ticks_per_secound = ticks_per_secound if ticks_per_secound
    gif.write(outputfile)
  end
end

GifAnime = Gifanime

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gifanime-0.1.1 lib/gifanime.rb
gifanime-0.1.0 lib/gifanime.rb