Class: CALayer
- Defined in:
- lib/sugarcube-uikit/calayer.rb,
lib/sugarcube-animations/calayer.rb
Instance Method Summary collapse
- #<<(layer) ⇒ Object
- #basic_animation(key_path, options = {}) ⇒ Object
- #keyframe_animation(key_path, options = {}) ⇒ Object
Instance Method Details
#<<(layer) ⇒ Object
3 4 5 6 |
# File 'lib/sugarcube-uikit/calayer.rb', line 3 def << (layer) self.addSublayer layer return self end |
#basic_animation(key_path, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sugarcube-animations/calayer.rb', line 3 def basic_animation(key_path, ={}) animation = CAAnimation.basic(key_path, ) should_add = .fetch(:add, true) if should_add if should_add.is_a?(NSString) name = should_add else name = key_path end self.addAnimation(animation, forKey: name) end if .key?(:to) self.setValue([:to], forKeyPath: key_path) end return animation end |
#keyframe_animation(key_path, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sugarcube-animations/calayer.rb', line 24 def keyframe_animation(key_path, ={}) animation = CAAnimation.keyframe(key_path, ) should_add = .fetch(:add, true) if should_add if should_add.is_a?(NSString) name = should_add else name = key_path end self.addAnimation(animation, forKey: name) end if .key?(:values) self.setValue([:values].last, forKeyPath: key_path) end return animation end |