Sha256: 665c8564eda25e72fc1c0bc8b4b93bbd88b84f692ccafd1815b656bdd65277b5

Contents?: true

Size: 442 Bytes

Versions: 4

Compression:

Stored size: 442 Bytes

Contents

require 'ruby-processing'

class ImageSequence < Processing::App

  def setup
    @index = 0
    @count = 7
    # loading the images into the array
    @images = (0...@count).map { |i| load_image("animal#{i}.jpg") }
    frame_rate 5
  end

  def draw
    # displaying one images
    image @images[@index], 0, 0 
    @index = (@index + 1) % @images.size
  end

end

ImageSequence.new :title => "Image Sequence", :width => 200, :height => 200

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-processing-1.0.1 samples/learning_processing/chapter_15/04_image_sequence.rb
ruby-processing-1.0.2 samples/learning_processing/chapter_15/04_image_sequence.rb
ruby-processing-1.0.3 samples/learning_processing/chapter_15/04_image_sequence.rb
ruby-processing-1.0.4 samples/learning_processing/chapter_15/04_image_sequence.rb