Commit 76395176 by Daniel Dahan

fixed animation issue, where animations were not persisting their end state

parent debf975c
......@@ -97,7 +97,7 @@ class AppViewController: NavigationViewController {
sideNavigationViewController?.enabled = true
// Position the menuBackdropLayer for the animation when closing.
menuBackdropLayer.animate(MaterialAnimation.scale(1, duration: 0.25))
menuBackdropLayer.animate(MaterialAnimation.scale(1))
menuView.menu.close()
image = UIImage(named: "ic_add_white")
......@@ -110,7 +110,7 @@ class AppViewController: NavigationViewController {
self.menuBackdropLayer.frame = self.menuView.frame
self.menuBackdropLayer.shape = .Circle
}
menuBackdropLayer.animate(MaterialAnimation.scale(30, duration: 0.25))
menuBackdropLayer.animate(MaterialAnimation.scale(30))
menuBackdropLayer.hidden = false
menuView.menu.open() { (v: UIView) in
......
......@@ -348,12 +348,8 @@ public class MaterialButton : UIButton {
if interrupted.
*/
public override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if let a: CAPropertyAnimation = anim as? CAPropertyAnimation {
if let b: CABasicAnimation = a as? CABasicAnimation {
layer.setValue(nil == b.toValue ? b.byValue : b.toValue, forKey: b.keyPath!)
}
if anim is CAPropertyAnimation {
(delegate as? MaterialAnimationDelegate)?.materialAnimationDidStop?(anim, finished: flag)
layer.removeAnimationForKey(a.keyPath!)
} else if let a: CAAnimationGroup = anim as? CAAnimationGroup {
for x in a.animations! {
animationDidStop(x, finished: true)
......
......@@ -280,14 +280,8 @@ public class MaterialLayer : CAShapeLayer {
if interrupted.
*/
public override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if let a: CAPropertyAnimation = anim as? CAPropertyAnimation {
if let b: CABasicAnimation = a as? CABasicAnimation {
MaterialAnimation.animationDisabled { [unowned self] in
self.setValue(nil == b.toValue ? b.byValue : b.toValue, forKey: b.keyPath!)
}
}
if anim is CAPropertyAnimation {
(delegate as? MaterialAnimationDelegate)?.materialAnimationDidStop?(anim, finished: flag)
// removeAnimationForKey(a.keyPath!)
} else if let a: CAAnimationGroup = anim as? CAAnimationGroup {
for x in a.animations! {
animationDidStop(x, finished: true)
......
......@@ -387,12 +387,8 @@ public class MaterialView : UIView {
if interrupted.
*/
public override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if let a: CAPropertyAnimation = anim as? CAPropertyAnimation {
if let b: CABasicAnimation = a as? CABasicAnimation {
layer.setValue(nil == b.toValue ? b.byValue : b.toValue, forKey: b.keyPath!)
}
if anim is CAPropertyAnimation {
(delegate as? MaterialAnimationDelegate)?.materialAnimationDidStop?(anim, finished: flag)
layer.removeAnimationForKey(a.keyPath!)
} else if let a: CAAnimationGroup = anim as? CAAnimationGroup {
for x in a.animations! {
animationDidStop(x, finished: true)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment