Last active
January 6, 2017 06:26
-
-
Save saoudrizwan/7f51936ff7e71fd95b9ef3745efda4e6 to your computer and use it in GitHub Desktop.
This file contains 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
// Add a completion block to the UIViewPropertyAnimator | |
linesConvergingAnimation.addCompletion({ (position) in | |
// since this is the reversed animation's completion block, the | |
// "final position" is the initial animation's target-start-position. | |
if position == .start { | |
self.linesAreX = false | |
// reset constraints back to normal | |
self.firstLine.snp.remakeConstraints({ (make) in | |
make.height.equalTo(self.lineHeight) | |
make.width.equalTo(self.containerView.snp.width) | |
make.centerX.equalTo(self.containerView.snp.centerX) | |
make.centerY.equalTo(0 + self.lineHeight/2) | |
}) | |
self.thirdLine.snp.remakeConstraints({ (make) in | |
make.height.equalTo(self.lineHeight) | |
make.width.equalTo(self.containerView.snp.width) | |
make.centerX.equalTo(self.containerView.snp.centerX) | |
make.centerY.equalTo(self.containerHeight - self.lineHeight/2) | |
}) | |
// notice I'm not calling .layoutIfNeeded() because there's nothing new to draw | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment