Created
December 29, 2019 10:54
-
-
Save agammahajan1/9b57cd1292c4c8055608d70d588487b6 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
private func getSpringAnimation(withInitialPostion initialPos: CGPoint, finalPos: CGPoint) -> CASpringAnimation { | |
let basicAnimation = CASpringAnimation(keyPath: "position") | |
basicAnimation.fromValue = NSValue(cgPoint: initialPos) | |
basicAnimation.toValue = NSValue(cgPoint: finalPos) | |
basicAnimation.duration = basicAnimation.settlingDuration | |
basicAnimation.damping = 14 | |
basicAnimation.initialVelocity = 5 | |
basicAnimation.isRemovedOnCompletion = false | |
basicAnimation.fillMode = CAMediaTimingFillMode.forwards | |
return basicAnimation | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment