mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various improvements
This commit is contained in:
@@ -955,6 +955,33 @@ public struct ComponentTransition {
|
||||
}
|
||||
}
|
||||
|
||||
public func setShadowPath(layer: CALayer, path: CGPath, completion: ((Bool) -> Void)? = nil) {
|
||||
switch self.animation {
|
||||
case .none:
|
||||
layer.shadowPath = path
|
||||
completion?(true)
|
||||
case let .curve(duration, curve):
|
||||
if let previousPath = layer.shadowPath, previousPath != path {
|
||||
layer.animate(
|
||||
from: previousPath,
|
||||
to: path,
|
||||
keyPath: "shadowPath",
|
||||
duration: duration,
|
||||
delay: 0.0,
|
||||
curve: curve,
|
||||
removeOnCompletion: true,
|
||||
additive: false,
|
||||
completion: completion
|
||||
)
|
||||
layer.shadowPath = path
|
||||
} else {
|
||||
layer.shadowPath = path
|
||||
completion?(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public func setShapeLayerPath(layer: CAShapeLayer, path: CGPath, completion: ((Bool) -> Void)? = nil) {
|
||||
switch self.animation {
|
||||
case .none:
|
||||
|
||||
Reference in New Issue
Block a user