Sha256: 8fa4ba62029406586cf3d54fb1455c0814efbad27befb8cfdd76726ce12cbb9b
Contents?: true
Size: 865 Bytes
Versions: 4
Compression:
Stored size: 865 Bytes
Contents
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../lib") $:.unshift File.expand_path(File.dirname(__FILE__) + "/../../ext") require 'ray' Ray.game "Circular motion" do register { add_hook :quit, method(:exit!) } scene :rotation do @sun = Ray::Polygon.circle([0, 0], 50, Ray::Color.yellow) @sun.pos = window.size / 2 @earth = Ray::Polygon.circle([0, 0], 20, Ray::Color.blue) @animation = circular_motion(:center => @sun.pos, :angle => 360, :duration => 5, :radius => 200).start(@earth) @animation.loop! on :key_press, key(:p) do if @animation.running? @animation.pause else @animation.resume end end always do @animation.update end render do |win| win.draw @earth win.draw @sun end end scenes << :rotation end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ray-0.2.1 | samples/animation/circle.rb |
ray-0.2.0 | samples/animation/circle.rb |
ray-0.1.1 | samples/animation/circle.rb |
ray-0.1.0 | samples/animation/circle.rb |