Class: Teaas::Pulse

Inherits:
Object
  • Object
show all
Defined in:
lib/teaas/pulse.rb

Class Method Summary collapse

Class Method Details

.pulse(original_img) ⇒ Magick::ImageList

This is a snapshot of a broken version of Spin that creates a cool pulsing image.

Parameters:

  • original_img (Magick::ImageList)

    The image to be rotated

Returns:

  • (Magick::ImageList)

    The pulsing image



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/teaas/pulse.rb', line 8

def self.pulse(original_img)
  pulsing_image = Magick::ImageList.new
  img = Teaas::Helper.prepare_for_animation(original_img)

  increment = 360 / 8

  8.times do |i|
    pulsing_image << img.rotate(increment * i+1).resize_to_fill(original_img.columns, original_img.rows)
  end

  pulsing_image
end

.pulse_from_file(path) ⇒ Magick::ImageList

This is a snapshot of a broken version of Spin that creates a cool pulsing image.

Parameters:

  • path (String)

    Path to the image to be spun

Returns:

  • (Magick::ImageList)

    The pulsing image



25
26
27
28
29
30
31
32
33
# File 'lib/teaas/pulse.rb', line 25

def self.pulse_from_file(path)
  img = Magick::ImageList.new

  # Grab the first element in array to prevent strange things when an
  # animated image is submitted
  img.read(path)[0]

  pulse(img)
end