Method: UIView#back_fiend!

Defined in:
lib/sugarcube-animations/uiview.rb

#back_fiend!(options = {}) ⇒ Object

Moves the view backwards, similar to what Google has been doing a lot recently



369
370
371
372
373
374
375
376
377
378
379
# File 'lib/sugarcube-animations/uiview.rb', line 369

def back_fiend!(options={})
  scale = options[:scale] || 0.5
  perspective = options[:perspective] || -0.0005
  size = options[:size] || -140

  UIView.animation_chain(duration:200.millisecs, options:UIViewAnimationOptionCurveLinear) {
    self.layer.transform = CATransform3DTranslate(CATransform3DScale(CATransform3D.new(1,0,0,0, 0,1,0,perspective, 0,0,1,0, 0,0,0,1), scale, scale, scale), 0, size, 0)
  }.and_then(duration:300.millisecs, options:UIViewAnimationOptionCurveLinear) {
    self.layer.transform = CATransform3DTranslate(CATransform3DScale(CATransform3DIdentity, scale, scale, scale), 0, size, 0)
  }.start
end