Fix transition to another value while animating

This commit is contained in:
Ali 2023-04-25 21:26:08 +04:00
parent 1037b25bc5
commit 268131263a

View File

@ -386,8 +386,15 @@ public struct Transition {
let t = layer.presentation()?.transform ?? layer.transform
let currentScale = sqrt((t.m11 * t.m11) + (t.m12 * t.m12) + (t.m13 * t.m13))
if currentScale == scale {
completion?(true)
return
if let animation = layer.animation(forKey: "transform.scale") as? CABasicAnimation, let toValue = animation.toValue as? NSNumber {
if toValue.doubleValue == scale {
completion?(true)
return
}
} else {
completion?(true)
return
}
}
switch self.animation {
case .none: