mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
[WIP] Call UI
This commit is contained in:
@@ -591,7 +591,7 @@ public struct Transition {
|
||||
completion?(true)
|
||||
case let .curve(duration, curve):
|
||||
let previousValue: CATransform3D
|
||||
if let presentation = layer.presentation() {
|
||||
if layer.animation(forKey: "transform") != nil, let presentation = layer.presentation() {
|
||||
previousValue = presentation.transform
|
||||
} else {
|
||||
previousValue = layer.transform
|
||||
@@ -703,6 +703,33 @@ public struct Transition {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public func setZPosition(layer: CALayer, zPosition: CGFloat, delay: Double = 0.0, completion: ((Bool) -> Void)? = nil) {
|
||||
if layer.zPosition == zPosition {
|
||||
completion?(true)
|
||||
return
|
||||
}
|
||||
switch self.animation {
|
||||
case .none:
|
||||
layer.zPosition = zPosition
|
||||
layer.removeAnimation(forKey: "zPosition")
|
||||
completion?(true)
|
||||
case let .curve(duration, curve):
|
||||
let previousZPosition = layer.presentation()?.opacity ?? layer.opacity
|
||||
layer.zPosition = zPosition
|
||||
layer.animate(
|
||||
from: previousZPosition as NSNumber,
|
||||
to: zPosition as NSNumber,
|
||||
keyPath: "zPosition",
|
||||
duration: duration,
|
||||
delay: delay,
|
||||
curve: curve,
|
||||
removeOnCompletion: true,
|
||||
additive: false,
|
||||
completion: completion
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public func animateScale(view: UIView, from fromValue: CGFloat, to toValue: CGFloat, delay: Double = 0.0, additive: Bool = false, completion: ((Bool) -> Void)? = nil) {
|
||||
switch self.animation {
|
||||
|
||||
Reference in New Issue
Block a user