class Gifanime

Constants

VERSION

Attributes

delay[RW]
frames[RW]
iterations[RW]
outputfile[RW]
scene[RW]
ticks_per_secound[RW]

Public Class Methods

new(outputfile, options = {}) click to toggle source
# File lib/gifanime.rb, line 5
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

Public Instance Methods

add(frame) click to toggle source
# File lib/gifanime.rb, line 15
def add(frame)
  frames << frame
end
generate!() click to toggle source
# File lib/gifanime.rb, line 19
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