Last active
August 29, 2015 14:17
-
-
Save akisute/134ad169394e034c9aa5 to your computer and use it in GitHub Desktop.
ParaMangar Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic example | |
let duration = 1.0 | |
self.animator = ParaMangar.renderViewForDuration(self.targetView, duration: duration, frameInterval: 2).toFile("Sample1", completion: {path in | |
self.animator = nil | |
println("Completed: \(path)") | |
}) | |
// More complex example | |
// Render UIView animations! | |
self.animator = ParaMangar.renderViewForDuration(self.targetView, duration: duration, block: { | |
UIView.animateWithDuration(duration/2, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 2.0, options: UIViewAnimationOptions.allZeros, animations: { () -> Void in | |
self.animatingView.transform = CGAffineTransformMakeScale(2.0, 2.0) | |
}, completion: nil) | |
UIView.animateWithDuration(duration/2, delay: duration/2, usingSpringWithDamping: 0.8, initialSpringVelocity: 2.0, options: UIViewAnimationOptions.allZeros, animations: { () -> Void in | |
self.animatingView.transform = CGAffineTransformIdentity | |
}, completion: nil) | |
}).toImage(duration, completion: { image in | |
self.animator = nil | |
self.imageView.image = image | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment