Sha256: 120c37080c450871cb2c78aa14192e464d46ab832c1d9d503aa70e6e4a9a2ce3

Contents?: true

Size: 744 Bytes

Versions: 4

Compression:

Stored size: 744 Bytes

Contents

#!/usr/bin/env ruby -w

require 'rmagick'

img = Magick::Image.read('images/Flower_Hat.jpg').first

legend = Magick::Draw.new
legend.stroke = 'transparent'
legend.fill = 'white'
legend.gravity = Magick::SouthGravity

frames = Magick::ImageList.new

implosion = 0.25
8.times do
  frames << img.implode(implosion)
  legend.annotate(frames, 0, 0, 10, 20, format('% 4.2f', implosion))
  frames.alpha(Magick::DeactivateAlphaChannel)
  implosion -= 0.10
end

7.times do
  implosion += 0.10
  frames << img.implode(implosion)
  legend.annotate(frames, 0, 0, 10, 20, format('% 4.2f', implosion))
  frames.alpha(Magick::DeactivateAlphaChannel)
end

frames.delay = 10
frames.iterations = 0
puts 'Producing animation...'

frames.write('implode.gif')
exit

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rmagick-4.1.0.rc2 doc/ex/implode.rb
rmagick-4.1.0.rc1 doc/ex/implode.rb
rmagick-4.0.0 doc/ex/implode.rb
rmagick-3.2.0 doc/ex/implode.rb