Bot previews

This commit is contained in:
Isaac
2024-07-19 20:25:14 +08:00
parent 4ee31cd176
commit c57dfdedc6
36 changed files with 1903 additions and 721 deletions

View File

@@ -1396,15 +1396,18 @@ public class CameraScreen: ViewController {
public weak var destinationView: UIView?
public let destinationRect: CGRect
public let destinationCornerRadius: CGFloat
public let completion: (() -> Void)?
public init(
destinationView: UIView,
destinationRect: CGRect,
destinationCornerRadius: CGFloat
destinationCornerRadius: CGFloat,
completion: (() -> Void)? = nil
) {
self.destinationView = destinationView
self.destinationRect = destinationRect
self.destinationCornerRadius = destinationCornerRadius
self.completion = completion
}
}
@@ -2182,9 +2185,12 @@ public class CameraScreen: ViewController {
let destinationLocalFrame = destinationView.convert(transitionOut.destinationRect, to: self.view)
let targetScale = destinationLocalFrame.width / self.previewContainerView.frame.width
let transitionOutCompletion = transitionOut.completion
if case .story = controller.mode {
self.previewContainerView.layer.animatePosition(from: self.previewContainerView.center, to: destinationLocalFrame.center, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, completion: { _ in
completion()
transitionOutCompletion?()
})
self.previewContainerView.layer.animateScale(from: 1.0, to: targetScale, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false)
@@ -2208,6 +2214,7 @@ public class CameraScreen: ViewController {
self.mainPreviewAnimationWrapperView.center = destinationInnerFrame.center
self.mainPreviewAnimationWrapperView.layer.animatePosition(from: initialCenter, to: self.mainPreviewAnimationWrapperView.center, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, completion: { _ in
completion()
transitionOutCompletion?()
})
var targetBounds = self.mainPreviewView.bounds