Skip to content

Instantly share code, notes, and snippets.

@akisute
Last active August 29, 2015 14:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
ParaMangar Example
// 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