Open strangeliu opened 5 years ago
Thanks for opening @strangeliu.
Can you please provide mode information on what you were trying to do, what you expected to happen, and what actually happened?
In the version v2.2.0, we can run an animation with AnimationRunner and set a callback when it finished running
let runner = AnimationRunner(animation: animation)
runner.onCompletion { _ in
print("animation finished running")
}
After upgrade to version 3.0.0, The AnimationRunner is removed, so i use animator.animate(to: targetValue, duration: duration)
to run an animation, but there's no way to know when the animation is finished running.
Got it – would adding back an optional completion argument be helpful for the methods on Animator
?
public enum CompletionReason {
case finished
case interrupted
}
public func animate(
to finalValue: Value,
duration: Double,
timingFunction: TimingFunction = .swiftOut,
completion: @escaping (CompletionReason) -> Void)
public func simulate<T>(
using function: T,
initialVelocity: T.Value,
completion: @escaping (CompletionReason) -> Void = { _ in }) where Value == T.Value, T : SimulationFunction
public func simulate<T>(
using function: T,
completion: @escaping (CompletionReason) -> Void = { _ in }) where Value == T.Value, T : SimulationFunction
Most of the previously public API was unused, so v3 moves toward a much simpler model – the advent of types like UIViewPropertyAnimator
mean that Advance is primarily useful for spring physics instead of general purpose animation. (Technically UIViewPropertyAnimator
can use springs to control timing, but it's not as well suited to general purpose springs)
Any update on this?
use
changedValue == targetValue
is incorrect for some reason.