Class: Gifanime
- Inherits:
-
Object
- Object
- Gifanime
- Defined in:
- lib/gifanime.rb,
lib/gifanime/version.rb
Constant Summary collapse
- VERSION =
"0.1.1"
Instance Attribute Summary collapse
-
#delay ⇒ Object
Returns the value of attribute delay.
-
#frames ⇒ Object
Returns the value of attribute frames.
-
#iterations ⇒ Object
Returns the value of attribute iterations.
-
#outputfile ⇒ Object
Returns the value of attribute outputfile.
-
#scene ⇒ Object
Returns the value of attribute scene.
-
#ticks_per_secound ⇒ Object
Returns the value of attribute ticks_per_secound.
Instance Method Summary collapse
- #add(frame) ⇒ Object
- #generate! ⇒ Object
-
#initialize(outputfile, options = {}) ⇒ Gifanime
constructor
A new instance of Gifanime.
Constructor Details
#initialize(outputfile, options = {}) ⇒ Gifanime
Returns a new instance of Gifanime.
5 6 7 8 9 10 11 12 13 |
# File 'lib/gifanime.rb', line 5 def initialize(outputfile, = {}) @delay = [:delay] @iterations = [:iterations] @scene = [:scene] @ticks_per_secound = [:ticks_per_secound] outputfile = outputfile + ".gif" unless outputfile =~ /\.gif\z/ @outputfile = outputfile @frames = [] end |
Instance Attribute Details
#delay ⇒ Object
Returns the value of attribute delay.
3 4 5 |
# File 'lib/gifanime.rb', line 3 def delay @delay end |
#frames ⇒ Object
Returns the value of attribute frames.
3 4 5 |
# File 'lib/gifanime.rb', line 3 def frames @frames end |
#iterations ⇒ Object
Returns the value of attribute iterations.
3 4 5 |
# File 'lib/gifanime.rb', line 3 def iterations @iterations end |
#outputfile ⇒ Object
Returns the value of attribute outputfile.
3 4 5 |
# File 'lib/gifanime.rb', line 3 def outputfile @outputfile end |
#scene ⇒ Object
Returns the value of attribute scene.
3 4 5 |
# File 'lib/gifanime.rb', line 3 def scene @scene end |
#ticks_per_secound ⇒ Object
Returns the value of attribute ticks_per_secound.
3 4 5 |
# File 'lib/gifanime.rb', line 3 def ticks_per_secound @ticks_per_secound end |
Instance Method Details
#add(frame) ⇒ Object
15 16 17 |
# File 'lib/gifanime.rb', line 15 def add(frame) frames << frame end |
#generate! ⇒ Object
19 20 21 22 23 24 25 26 |
# 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 |