Sha256: 81de097349cb135d23a25d8876968c60c3e0fca9e9592c79509b2fe1590f33ac
Contents?: true
Size: 979 Bytes
Versions: 1
Compression:
Stored size: 979 Bytes
Contents
require 'singleton' require 'forwardable' module Tsuku class Tweener include Singleton def initialize super @tweens = [] @running = true end def add_tween(target, final_property_values, duration_ms, easing = :linear) tween = Tween.new(target, final_property_values, duration_ms, easing) tween.start @tweens << tween tween end def step(delta_ms) return if !@running @tweens.reverse_each do |tween| tween.step(delta_ms) if tween.completed? @tweens.delete(tween) end end end def pause @running = false end def resume @running = true end class << self extend Forwardable # delegate all instance methods to singleton instance to allow calling # methods without '.instance' (i.e. Tweener.add_tween) def_delegators :instance, *Tweener.instance_methods(false) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tsuku-0.1.2 | lib/tsuku/tweener.rb |