Fix animation

This commit is contained in:
Ali 2022-01-13 21:05:24 +04:00
parent 1831f1e84b
commit fcea45e044
2 changed files with 16 additions and 1 deletions

View File

@ -504,6 +504,17 @@ final class ContextControllerExtractedPresentationNode: ASDisplayNode, ContextCo
)
if let reactionContextNode = self.reactionContextNode {
let reactionsPositionDeltaYDistance = -animationInContentDistance
reactionContextNode.layer.animateSpring(
from: NSValue(cgPoint: CGPoint(x: 0.0, y: reactionsPositionDeltaYDistance)),
to: NSValue(cgPoint: CGPoint()),
keyPath: "position",
duration: duration,
delay: 0.0,
initialVelocity: 0.0,
damping: springDamping,
additive: true
)
reactionContextNode.animateIn(from: currentContentScreenFrame)
}

View File

@ -606,7 +606,7 @@ public final class ReactionContextNode: ASDisplayNode, UIScrollViewDelegate {
intermediateCompletion()
}
transition.animatePositionWithKeyframes(node: itemNode, keyframes: generateParabollicMotionKeyframes(from: selfSourceRect.center, to: expandedFrame.center, elevation: 30.0), completion: { [weak self, weak itemNode, weak targetView] _ in
transition.animatePositionWithKeyframes(node: itemNode, keyframes: generateParabollicMotionKeyframes(from: selfSourceRect.center, to: expandedFrame.center, elevation: 30.0), completion: { [weak self, weak itemNode, weak targetView, weak animateTargetContainer] _ in
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1, execute: {
guard let strongSelf = self else {
return
@ -620,7 +620,11 @@ public final class ReactionContextNode: ASDisplayNode, UIScrollViewDelegate {
guard let targetView = targetView as? ReactionIconView else {
return
}
if let animateTargetContainer = animateTargetContainer {
animateTargetContainer.isHidden = false
}
targetView.isHidden = false
targetView.alpha = 1.0
targetView.imageView.alpha = 0.0
targetView.addSubnode(itemNode)
itemNode.frame = targetView.bounds