class Phantom::SVG::Frame

Frame class for “Key Frames” implementation in SVG

Attributes

duration[RW]
height[RW]
namespaces[RW]
surfaces[RW]
viewbox[RW]
width[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/phantom/frame.rb, line 7
def initialize(options = {})
  set_duration(options[:duration])
  set_surfaces(options[:surfaces])
  set_width(options[:width])
  set_height(options[:height])
  set_viewbox(options[:viewbox])
  set_namespaces(options[:namespaces])
end

Private Instance Methods

set_duration(val) click to toggle source
# File lib/phantom/frame.rb, line 40
def set_duration(val)
  @duration = val.nil? ? 0.1 : val
end
set_height(val) click to toggle source
# File lib/phantom/frame.rb, line 52
def set_height(val)
  @height = val.nil? ? 64 : val
end
set_namespaces(val) click to toggle source
# File lib/phantom/frame.rb, line 65
def set_namespaces(val)
  @namespaces = val.nil? ? {} : val
end
set_surfaces(val) click to toggle source
# File lib/phantom/frame.rb, line 44
def set_surfaces(val)
  @surfaces = val.nil? ? nil : val
end
set_viewbox(val) click to toggle source
# File lib/phantom/frame.rb, line 56
def set_viewbox(val)
  @viewbox =
    if val.nil?               then  ViewBox.new(0, 0, @width, @height)
    elsif val.is_a?(ViewBox)  then  val
    elsif val.is_a?(String)   then  ViewBox.new.set_from_text(val)
    else                            ViewBox.new(0, 0, @width, @height)
    end
end
set_width(val) click to toggle source
# File lib/phantom/frame.rb, line 48
def set_width(val)
  @width = val.nil? ? 64 : val
end