Sha256: 4a2adc24ab0bdc1c617cb3da35fc8f39b1c76fd56a23bd3052c6b11b2d5e826c

Contents?: true

Size: 876 Bytes

Versions: 2

Compression:

Stored size: 876 Bytes

Contents

require 'rexml/document'

require_relative '../frame.rb'
require_relative 'abstract_animation_reader.rb'

module Phantom
  module SVG
    module Parser
      # AnimationReader for XML.
      class XMLAnimationReader < AbstractAnimationReader
        private

        # Read parameter from animation information file.
        def read_parameter(path)
          xml = REXML::Document.new(open(path))

          animation = xml.elements['animation']
          return if animation.nil?

          animation.attributes.each do |key, val|
            set_parameter(key, val)
          end

          animation.elements.each('frame') do |element|
            add_frame_info(element.attributes['src'], element.attributes['delay'])
          end
        end
      end # class XMLAnimationReader < AbstractAnimationReader
    end # module Parser
  end # module SVG
end # module Phantom

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phantom_svg-1.2.8 lib/phantom/parser/xml_animation_reader.rb
phantom_svg-1.2.7 lib/phantom/parser/xml_animation_reader.rb