Skip to content

Commit

Permalink
update thumbView shadow with animation. Closes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Vogelzang committed Dec 10, 2016
1 parent 6455119 commit f92d449
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions SevenSwitch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ import QuartzCore
self.isAnimating = false
})

let shadowAnim = CABasicAnimation(keyPath: "shadowPath")
shadowAnim.duration = 0.3
shadowAnim.fromValue = thumbView.layer.shadowPath
shadowAnim.toValue = UIBezierPath(roundedRect: thumbView.bounds, cornerRadius: thumbView.layer.cornerRadius).cgPath
thumbView.layer.add(shadowAnim, forKey: "shadowPath")
thumbView.layer.shadowPath = UIBezierPath(roundedRect: thumbView.bounds, cornerRadius: thumbView.layer.cornerRadius).cgPath

return true
}

Expand Down Expand Up @@ -446,6 +453,13 @@ import QuartzCore
}, completion: { finished in
self.isAnimating = false
})

let shadowAnim = CABasicAnimation(keyPath: "shadowPath")
shadowAnim.duration = 0.3
shadowAnim.fromValue = thumbView.layer.shadowPath
shadowAnim.toValue = UIBezierPath(roundedRect: thumbView.bounds, cornerRadius: thumbView.layer.cornerRadius).cgPath
thumbView.layer.add(shadowAnim, forKey: "shadowPath")
thumbView.layer.shadowPath = UIBezierPath(roundedRect: thumbView.bounds, cornerRadius: thumbView.layer.cornerRadius).cgPath
}
else {
if self.isTracking {
Expand Down Expand Up @@ -497,6 +511,13 @@ import QuartzCore
}, completion: { finished in
self.isAnimating = false
})

let shadowAnim = CABasicAnimation(keyPath: "shadowPath")
shadowAnim.duration = 0.3
shadowAnim.fromValue = thumbView.layer.shadowPath
shadowAnim.toValue = UIBezierPath(roundedRect: thumbView.bounds, cornerRadius: thumbView.layer.cornerRadius).cgPath
thumbView.layer.add(shadowAnim, forKey: "shadowPath")
thumbView.layer.shadowPath = UIBezierPath(roundedRect: thumbView.bounds, cornerRadius: thumbView.layer.cornerRadius).cgPath
}
else {
if (self.isTracking) {
Expand Down

0 comments on commit f92d449

Please sign in to comment.