Commit b9f7bf00 by Daniel Dahan

development: added fade to MotionAnimation

parent 00a46e33
...@@ -63,7 +63,7 @@ extension Motion { ...@@ -63,7 +63,7 @@ extension Motion {
*/ */
public static func path(bezierPath: UIBezierPath, mode: AnimationRotationMode = .auto, duration: CFTimeInterval? = nil) -> CAKeyframeAnimation { public static func path(bezierPath: UIBezierPath, mode: AnimationRotationMode = .auto, duration: CFTimeInterval? = nil) -> CAKeyframeAnimation {
let animation = CAKeyframeAnimation() let animation = CAKeyframeAnimation()
animation.keyPath = AnimationKeyPath.position.rawValue animation.keyPath = MotionAnimationKeyPath.position.rawValue
animation.path = bezierPath.cgPath animation.path = bezierPath.cgPath
animation.rotationMode = AnimationRotationModeToValue(mode: mode) animation.rotationMode = AnimationRotationModeToValue(mode: mode)
......
...@@ -146,13 +146,13 @@ extension PulseMotion { ...@@ -146,13 +146,13 @@ extension PulseMotion {
switch animation { switch animation {
case .centerWithBacking, .backing, .pointWithBacking, .tap: case .centerWithBacking, .backing, .pointWithBacking, .tap:
bLayer.add(Motion.background(color: color.withAlphaComponent(opacity / 2), duration: duration), forKey: nil) bLayer.motion(duration: duration, animations: .background(color: color.withAlphaComponent(opacity / 2)))
default:break default:break
} }
switch animation { switch animation {
case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking: case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking:
pLayer.add(Motion.scale(by: 1, duration: duration), forKey: nil) pLayer.motion(duration: duration, animations: .scale(by: 1))
default:break default:break
} }
...@@ -182,16 +182,13 @@ extension PulseMotion { ...@@ -182,16 +182,13 @@ extension PulseMotion {
switch animation { switch animation {
case .centerWithBacking, .backing, .pointWithBacking, .tap: case .centerWithBacking, .backing, .pointWithBacking, .tap:
bLayer.add(Motion.background(color: color.withAlphaComponent(0), duration: duration), forKey: nil) bLayer.motion(duration: duration, animations: .background(color: color.withAlphaComponent(0)))
default:break default:break
} }
switch animation { switch animation {
case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking: case .center, .centerWithBacking, .centerRadialBeyondBounds, .radialBeyondBounds, .point, .pointWithBacking:
pLayer.add(Motion.animate(group: [ pLayer.motion(duration: duration, animations: .scale(by: .center == animation ? 1 : 1.325), .background(color: color.withAlphaComponent(0)))
Motion.scale(by: .center == animation ? 1 : 1.325),
Motion.background(color: color.withAlphaComponent(0))
], duration: duration), forKey: nil)
default:break default:break
} }
......
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