Created
November 11, 2014 04:40
-
-
Save nobodyiscertain/4a04e97917c91ddc2fca to your computer and use it in GitHub Desktop.
CATransaction Completion Block
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
def logo_view_was_tapped | |
CATransaction.begin | |
timing = CAMediaTimingFunction.send('functionWithControlPoints::::', 0.28, -0.3, 0.12, 1.0) | |
rotateAnimation = CABasicAnimation.animationWithKeyPath("transform.rotation") | |
rotateAnimation.toValue = Math::PI / 180 * 720 | |
rotateAnimation.duration = 2.0 | |
rotateAnimation.timingFunction = timing | |
CATransaction.setCompletionBlock lambda { | |
# Fancy code to run when completed | |
} | |
@logo_view.layer.addAnimation(rotateAnimation, forKey: :logo_spinning) | |
CATransaction.commit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment