Created
October 30, 2016 21:20
-
-
Save msadoon/84d37221001170f6416119cadc09d4b2 to your computer and use it in GitHub Desktop.
UIView Frame Animation
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
let newFrame = CGRect(x:self.frame.origin.x, y: self.frame.origin.y, width:self.frame.size.width, height:((self.frame.size.height*2) + heightDiff)); | |
let scale:CABasicAnimation = CABasicAnimation.init(keyPath:"path"); | |
print("newFrame: \(newFrame)"); | |
scale.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut); | |
scale.fromValue = self.frame; | |
scale.toValue = newFrame; | |
scale.duration = 1.0; | |
scale.isRemovedOnCompletion = false; | |
scale.fillMode = kCAFillModeForwards; | |
scale.delegate = self; | |
self.maskLayer.add(scale, forKey: "path"); | |
self.frame = CGRect(x:self.frame.origin.x, y: self.frame.origin.y, width:self.frame.size.width, height:((self.frame.size.height*2) + heightDiff)); | |
print("frame after animation: \(self.frame)"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment