Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nhatlee/TKSubmitTransition
Browse files Browse the repository at this point in the history
…into nhatlee-master
  • Loading branch information
RishabhTayal committed Feb 7, 2018
2 parents c4bb8f0 + 02a47d4 commit 11b431c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -40,4 +40,5 @@ xcuserdata
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build
Carthage/Build
.DS_Store
12 changes: 6 additions & 6 deletions SubmitTransition/Classes/TransitionSubmitButton.swift
Expand Up @@ -59,17 +59,17 @@ open class TKTransitionSubmitButton : UIButton, UIViewControllerTransitioningDel

}

open func startFinishAnimation(_ delay: TimeInterval, completion:(()->())?) {
open func startFinishAnimation(_ delay: TimeInterval,_ animation: CAMediaTimingFunction, completion:(()->())?) {
Timer.schedule(delay: delay) { timer in
self.didEndFinishAnimation = completion
self.expand()
self.expand(animation)
self.spiner.stopAnimation()
}
}

open func animate(_ duration: TimeInterval, completion:(()->())?) {
open func animate(_ duration: TimeInterval,_ animation: CAMediaTimingFunction, completion:(()->())?) {
startLoadingAnimation()
startFinishAnimation(duration, completion: completion)
startFinishAnimation(duration, animation, completion: completion)
}

open func setOriginalState() {
Expand Down Expand Up @@ -105,11 +105,11 @@ open class TKTransitionSubmitButton : UIButton, UIViewControllerTransitioningDel
layer.add(shrinkAnim, forKey: shrinkAnim.keyPath)
}

func expand() {
func expand(_ animation: CAMediaTimingFunction) {
let expandAnim = CABasicAnimation(keyPath: "transform.scale")
expandAnim.fromValue = 1.0
expandAnim.toValue = 26.0
expandAnim.timingFunction = expandCurve
expandAnim.timingFunction = animation
expandAnim.duration = 0.3
expandAnim.delegate = self
expandAnim.fillMode = kCAFillModeForwards
Expand Down

0 comments on commit 11b431c

Please sign in to comment.