Skip to content

Instantly share code, notes, and snippets.

@akisute
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akisute/134ad169394e034c9aa5 to your computer and use it in GitHub Desktop.
Save akisute/134ad169394e034c9aa5 to your computer and use it in GitHub Desktop.
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