Sha256: 7d88340115e593c3d689c627181ccf1f3ef36a641e7e4d0a7f7e00ebf1ffad62
Contents?: true
Size: 640 Bytes
Versions: 2
Compression:
Stored size: 640 Bytes
Contents
require 'gnawrnip/screenshot' require 'RMagick' require 'base64' module Gnawrnip class Animation class << self def reset! frames.clear end def frames @frames ||= [] end def add_frame image = Screenshot.take frames << image end def generate gif = Tempfile.new(['gnawrnip_animation', '.gif']) image.write(gif.path) Base64.encode64(gif.read) end private def image paths = frames.map(&:path) images = Magick::ImageList.new(*paths) images.delay = 50 images end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gnawrnip-0.0.3 | lib/gnawrnip/animation.rb |
gnawrnip-0.0.2 | lib/gnawrnip/animation.rb |