Update animations

This commit is contained in:
Ali
2021-05-20 03:37:33 +04:00
parent f4931a77f6
commit a984721970
11 changed files with 209 additions and 37 deletions

View File

@@ -665,26 +665,27 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
}
}
func animateContentFromTextInputField(textInput: ChatMessageTransitionNode.Source.TextInput, horizontalTransition: ContainedViewLayoutTransition, verticalTransition: ContainedViewLayoutTransition) {
func animateContentFromTextInputField(textInput: ChatMessageTransitionNode.Source.TextInput, transition: CombinedTransition) {
guard let item = self.item else {
return
}
let widthDifference = self.backgroundNode.frame.width - textInput.backgroundView.frame.width
let heightDifference = self.backgroundNode.frame.height - textInput.backgroundView.frame.height
horizontalTransition.animateFrame(node: self.clippingNode, from: CGRect(origin: CGPoint(x: self.clippingNode.frame.minX, y: textInput.backgroundView.frame.minY), size: textInput.backgroundView.frame.size))
horizontalTransition.animateOffsetAdditive(layer: self.clippingNode.layer, offset: textInput.backgroundView.frame.minY - self.clippingNode.frame.minY)
transition.animateFrame(layer: self.clippingNode.layer, from: CGRect(origin: CGPoint(x: self.clippingNode.frame.minX, y: textInput.backgroundView.frame.minY), size: textInput.backgroundView.frame.size))
self.backgroundWallpaperNode.animateFrom(sourceView: textInput.backgroundView, mediaBox: item.context.account.postbox.mediaBox, transition: horizontalTransition)
self.backgroundNode.animateFrom(sourceView: textInput.backgroundView, transition: horizontalTransition)
transition.vertical.animateOffsetAdditive(layer: self.clippingNode.layer, offset: textInput.backgroundView.frame.minY - self.clippingNode.frame.minY)
self.backgroundWallpaperNode.animateFrom(sourceView: textInput.backgroundView, mediaBox: item.context.account.postbox.mediaBox, transition: transition)
self.backgroundNode.animateFrom(sourceView: textInput.backgroundView, transition: transition)
for contentNode in self.contentNodes {
if let contentNode = contentNode as? ChatMessageTextBubbleContentNode {
let localSourceContentFrame = self.mainContextSourceNode.contentNode.view.convert(textInput.contentView.frame.offsetBy(dx: self.mainContextSourceNode.contentRect.minX, dy: self.mainContextSourceNode.contentRect.minY), to: contentNode.view)
textInput.contentView.frame = localSourceContentFrame
contentNode.animateFrom(sourceView: textInput.contentView, widthDifference: widthDifference, transition: horizontalTransition)
contentNode.animateFrom(sourceView: textInput.contentView, scrollOffset: textInput.scrollOffset, widthDifference: widthDifference, transition: transition)
} else if let contentNode = contentNode as? ChatMessageWebpageBubbleContentNode {
horizontalTransition.animatePositionAdditive(node: contentNode, offset: CGPoint(x: 0.0, y: heightDifference))
transition.vertical.animatePositionAdditive(node: contentNode, offset: CGPoint(x: 0.0, y: heightDifference))
}
}
}