Open jverkoey opened 7 years ago
Here's my hack solution:
let spring = Spring<CGFloat>(threshold: 0.01, system: coreAnimation)
spring.destination.value = 1
runtime.add(spring, to: runtime.get(square.layer).scale)
let tap = runtime.get(UITapGestureRecognizer())
runtime.connect(tap.whenRecognitionState(is: .recognized).rewriteTo(1.5), to: spring.destination)
runtime.connect(tap.whenRecognitionState(is: .recognized).delay(by: 0.1).rewriteTo(1), to: spring.destination)
Consider the following interaction:
When using POP, this would behave as expected; the view would scale outward somewhat and eventually settle back at 1. This is because POP looks at the overall energy in the system to determine completeness.
When using Core Animation, however, this animation does nothing. This is because Core Animation thinks of velocity only relative to the distance to be traveled (in this case 0), so the animation ends up nooping.
I'm not sure whether there's a clear fix here, but I'll explore some hackfixes.