Skip to content

Instantly share code, notes, and snippets.

@z5ottu
Created January 4, 2016 11:40
Show Gist options
  • Save z5ottu/b5593925f4289a35f933 to your computer and use it in GitHub Desktop.
Save z5ottu/b5593925f4289a35f933 to your computer and use it in GitHub Desktop.
Swift: UIView 3d transform animation style: horizontal flip
let layer = sender.layer
var rotationAndPerspectiveTransform : CATransform3D = CATransform3DIdentity
rotationAndPerspectiveTransform.m34 = 1.0 / -1000
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, CGFloat(M_PI / 0.3), 0.0, 1.0, 0.0)
layer.transform = rotationAndPerspectiveTransform
UIView.animateWithDuration(2.0, animations: {
layer.transform = CATransform3DIdentity
})
@DenimMerzhan
Copy link

thanks, it helped a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment