Class: Phantom::SVG::Parser::AbstractAnimationReader
- Inherits:
-
Object
- Object
- Phantom::SVG::Parser::AbstractAnimationReader
- Defined in:
- lib/phantom/parser/abstract_animation_reader.rb
Overview
AnimationReader base.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#frames ⇒ Object
Returns the value of attribute frames.
-
#loops ⇒ Object
Returns the value of attribute loops.
-
#skip_first ⇒ Object
Returns the value of attribute skip_first.
Instance Method Summary collapse
-
#initialize(path = nil) ⇒ AbstractAnimationReader
constructor
Construct AbstractAnimationReader object.
-
#read(path, do_reset = true) ⇒ Object
Read and create frames from animation information file.
Constructor Details
#initialize(path = nil) ⇒ AbstractAnimationReader
Construct AbstractAnimationReader object.
11 12 13 14 |
# File 'lib/phantom/parser/abstract_animation_reader.rb', line 11 def initialize(path = nil) reset read(path) unless path.nil? end |
Instance Attribute Details
#frames ⇒ Object
Returns the value of attribute frames.
8 9 10 |
# File 'lib/phantom/parser/abstract_animation_reader.rb', line 8 def frames @frames end |
#loops ⇒ Object
Returns the value of attribute loops.
8 9 10 |
# File 'lib/phantom/parser/abstract_animation_reader.rb', line 8 def loops @loops end |
#skip_first ⇒ Object
Returns the value of attribute skip_first.
8 9 10 |
# File 'lib/phantom/parser/abstract_animation_reader.rb', line 8 def skip_first @skip_first end |
Instance Method Details
#read(path, do_reset = true) ⇒ Object
Read and create frames from animation information file. Return array of Phantom::SVG::Frame.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/phantom/parser/abstract_animation_reader.rb', line 18 def read(path, do_reset = true) reset if do_reset # Read parameter from spec file. read_parameter(path) # Change current directory to animation information file's directory. old_dir = Dir.pwd Dir.chdir(File.dirname(path)) # Create frames from animation information file parameter. create_frames # Change current directory to default. Dir.chdir(old_dir) # Return frames. @frames end |