Text-webpage position swap animation

This commit is contained in:
Ali
2023-10-24 17:14:39 +04:00
parent db38904254
commit 56bf7fac1e
9 changed files with 265 additions and 138 deletions

View File

@@ -2070,7 +2070,21 @@ public final class ControlledTransition {
if layer.bounds == bounds {
return
}
let fromValue = layer.presentation()?.bounds ?? layer.bounds
let fromValue: CGRect
if let animationKeys = layer.animationKeys(), animationKeys.contains(where: { key in
guard let animation = layer.animation(forKey: key) as? CAPropertyAnimation else {
return false
}
if animation.keyPath == "bounds" {
return true
} else {
return false
}
}) {
fromValue = layer.presentation()?.bounds ?? layer.bounds
} else {
fromValue = layer.bounds
}
layer.bounds = bounds
self.add(animation: ControlledTransitionProperty(
layer: layer,