Sha256: f3cde83bedf8cd3e48cc08b3611fd9ef17630294108f02c5b55ff1edd68b598c

Contents?: true

Size: 954 Bytes

Versions: 4

Compression:

Stored size: 954 Bytes

Contents

$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../lib")
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../ext")

require 'ray'

Ray.game "Chained animations" do
  register { add_hook :quit, method(:exit!) }

  scene :animation_chain do
    @text = text "Hello world!", :at => [100, 100], :size => 30

    @animations = animation_combination
    @animations << color_variation(:from => Ray::Color.green,
                                   :to => Ray::Color.blue,
                                   :duration => 3)
    @animations << translation(:of => [200, 200], :duration => 3)
    @animations << scale_variation(:of => [1, 1], :duration => 3)
    @animations << rotation(:of => 180, :duration => 3)

    @reverse_animations = @animations.start(@text).bounce!

    always do
      @animations.update
      @reverse_animations.update
    end

    render do |win|
      win.draw @text
    end
  end

  scenes << :animation_chain
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ray-0.2.1 samples/animation/chain.rb
ray-0.2.0 samples/animation/chain.rb
ray-0.1.1 samples/animation/chain.rb
ray-0.1.0 samples/animation/chain.rb