mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Animation and other improvements
This commit is contained in:
@@ -24,6 +24,7 @@ import UIKitRuntimeUtils
|
||||
}
|
||||
if let completion = self.completion {
|
||||
completion(flag)
|
||||
self.completion = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,6 +84,9 @@ public extension CALayer {
|
||||
animation.beginTime = self.convertTime(CACurrentMediaTime(), from: nil) + delay * UIView.animationDurationFactor()
|
||||
animation.fillMode = .both
|
||||
}
|
||||
if #available(iOS 15.0, *) {
|
||||
animation.preferredFrameRateRange = CAFrameRateRange(minimum: Float(UIScreen.main.maximumFramesPerSecond), maximum: Float(UIScreen.main.maximumFramesPerSecond), preferred: Float(UIScreen.main.maximumFramesPerSecond))
|
||||
}
|
||||
return animation
|
||||
} else if timingFunction == kCAMediaTimingFunctionSpring {
|
||||
let animation = makeSpringAnimation(keyPath)
|
||||
@@ -108,6 +112,10 @@ public extension CALayer {
|
||||
animation.fillMode = .both
|
||||
}
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
animation.preferredFrameRateRange = CAFrameRateRange(minimum: Float(UIScreen.main.maximumFramesPerSecond), maximum: Float(UIScreen.main.maximumFramesPerSecond), preferred: Float(UIScreen.main.maximumFramesPerSecond))
|
||||
}
|
||||
|
||||
return animation
|
||||
} else {
|
||||
let k = Float(UIView.animationDurationFactor())
|
||||
@@ -138,6 +146,10 @@ public extension CALayer {
|
||||
animation.fillMode = .both
|
||||
}
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
animation.preferredFrameRateRange = CAFrameRateRange(minimum: Float(UIScreen.main.maximumFramesPerSecond), maximum: Float(UIScreen.main.maximumFramesPerSecond), preferred: Float(UIScreen.main.maximumFramesPerSecond))
|
||||
}
|
||||
|
||||
return animation
|
||||
}
|
||||
}
|
||||
@@ -196,6 +208,10 @@ public extension CALayer {
|
||||
animation.delegate = CALayerAnimationDelegate(animation: animation, completion: completion)
|
||||
}
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
animation.preferredFrameRateRange = CAFrameRateRange(minimum: Float(UIScreen.main.maximumFramesPerSecond), maximum: Float(UIScreen.main.maximumFramesPerSecond), preferred: Float(UIScreen.main.maximumFramesPerSecond))
|
||||
}
|
||||
|
||||
self.add(animation, forKey: keyPath)
|
||||
}
|
||||
|
||||
@@ -225,6 +241,10 @@ public extension CALayer {
|
||||
animation.speed = speed * Float(animation.duration / duration)
|
||||
animation.isAdditive = additive
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
animation.preferredFrameRateRange = CAFrameRateRange(minimum: Float(UIScreen.main.maximumFramesPerSecond), maximum: Float(UIScreen.main.maximumFramesPerSecond), preferred: Float(UIScreen.main.maximumFramesPerSecond))
|
||||
}
|
||||
|
||||
return animation
|
||||
}
|
||||
|
||||
@@ -257,6 +277,10 @@ public extension CALayer {
|
||||
animation.speed = speed * Float(animation.duration / duration)
|
||||
animation.isAdditive = additive
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
animation.preferredFrameRateRange = CAFrameRateRange(minimum: Float(UIScreen.main.maximumFramesPerSecond), maximum: Float(UIScreen.main.maximumFramesPerSecond), preferred: Float(UIScreen.main.maximumFramesPerSecond))
|
||||
}
|
||||
|
||||
self.add(animation, forKey: keyPath)
|
||||
}
|
||||
|
||||
@@ -284,6 +308,10 @@ public extension CALayer {
|
||||
animation.delegate = CALayerAnimationDelegate(animation: animation, completion: completion)
|
||||
}
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
animation.preferredFrameRateRange = CAFrameRateRange(minimum: Float(UIScreen.main.maximumFramesPerSecond), maximum: Float(UIScreen.main.maximumFramesPerSecond), preferred: Float(UIScreen.main.maximumFramesPerSecond))
|
||||
}
|
||||
|
||||
self.add(animation, forKey: key)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user