Commit 4b8a39b8 by Daniel Dahan

development: issue-641: Added a new tap PulseAnimation type, which has an…

development: issue-641: Added a new tap PulseAnimation type, which has an instant feedback response when tapping.
parent 7d3ade62
...@@ -38,6 +38,7 @@ public enum PulseAnimation: Int { ...@@ -38,6 +38,7 @@ public enum PulseAnimation: Int {
case centerRadialBeyondBounds case centerRadialBeyondBounds
case radialBeyondBounds case radialBeyondBounds
case backing case backing
case tap
case point case point
case pointWithBacking case pointWithBacking
} }
...@@ -141,10 +142,10 @@ extension PulseMotion { ...@@ -141,10 +142,10 @@ extension PulseMotion {
bLayer.setValue(false, forKey: "animated") bLayer.setValue(false, forKey: "animated")
let duration: CFTimeInterval = .center == animation ? 0.16125 : 0.325 let duration: TimeInterval = .tap == animation ? 0 : .center == animation ? 0.16125 : 0.325
switch animation { switch animation {
case .centerWithBacking, .backing, .pointWithBacking: case .centerWithBacking, .backing, .pointWithBacking, .tap:
bLayer.add(Motion.backgroundColor(color: color.withAlphaComponent(opacity / 2), duration: duration), forKey: nil) bLayer.add(Motion.backgroundColor(color: color.withAlphaComponent(opacity / 2), duration: duration), forKey: nil)
default:break default:break
} }
...@@ -177,10 +178,10 @@ extension PulseMotion { ...@@ -177,10 +178,10 @@ extension PulseMotion {
return return
} }
let duration = 0.325 let duration: TimeInterval = 0.325
switch animation { switch animation {
case .centerWithBacking, .backing, .pointWithBacking: case .centerWithBacking, .backing, .pointWithBacking, .tap:
bLayer.add(Motion.backgroundColor(color: color.withAlphaComponent(0), duration: duration), forKey: nil) bLayer.add(Motion.backgroundColor(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