Various improvements

This commit is contained in:
Isaac
2025-03-13 00:34:59 +01:00
parent 950c3d9f1e
commit bb015f2bfa
16 changed files with 671 additions and 210 deletions

View File

@@ -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: