Class: Walt::AnimationSet
- Inherits:
-
Object
- Object
- Walt::AnimationSet
- Extended by:
- Support::AttrDefault
- Defined in:
- lib/walt/animation_set.rb
Constant Summary collapse
- PROPERTIES =
[:animations, :assets]
Instance Method Summary collapse
- #animate ⇒ Object
- #animations=(animations) ⇒ Object
- #assets=(assets) ⇒ Object
-
#initialize(params = {}) ⇒ AnimationSet
constructor
A new instance of AnimationSet.
Methods included from Support::AttrDefault
Constructor Details
#initialize(params = {}) ⇒ AnimationSet
Returns a new instance of AnimationSet.
18 19 20 21 22 23 24 |
# File 'lib/walt/animation_set.rb', line 18 def initialize(params = {}) params.each do |key, value| if PROPERTIES.include?(key.to_sym) self.send("#{key}=", value) end end end |
Instance Method Details
#animate ⇒ Object
59 60 61 62 63 64 |
# File 'lib/walt/animation_set.rb', line 59 def animate self.animations.each do |animation| animation.assets = self.assets animation.animate end end |
#animations=(animations) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/walt/animation_set.rb', line 27 def animations=(animations) _animations = animations && animations.collect do |animation| case animation when Walt::Animation animation when NSDictionary Walt::Animation.new(animation) else raise "Invalid class for animation #{animation.inspect}" end end @animations = _animations end |
#assets=(assets) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/walt/animation_set.rb', line 42 def assets=(assets) _assets = assets && assets.collect do |asset| case asset when Walt::Asset asset when NSDictionary Walt::Asset.for(asset) when UIView Walt::Asset.for(asset) else raise "Invalid class for asset #{asset.inspect}" end asset end @assets = _assets end |