mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Use timer for animation
This commit is contained in:
parent
51c0888313
commit
83e3b3bd6c
@ -553,11 +553,12 @@ public final class MultiAnimationRendererImpl: MultiAnimationRenderer {
|
||||
self.f()
|
||||
}
|
||||
}
|
||||
let displayTimer = Foundation.Timer(timeInterval: CGFloat(self.frameSkip) / 60.0, target: TimerTarget { [weak self] in
|
||||
let frameInterval = Double(self.frameSkip) / 60.0
|
||||
let displayTimer = Foundation.Timer(timeInterval: frameInterval, target: TimerTarget { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.animationTick()
|
||||
strongSelf.animationTick(frameInterval: frameInterval)
|
||||
}, selector: #selector(TimerTarget.timerEvent), userInfo: nil, repeats: true)
|
||||
self.displayTimer = displayTimer
|
||||
RunLoop.main.add(displayTimer, forMode: .common)
|
||||
@ -646,8 +647,8 @@ public final class MultiAnimationRendererImpl: MultiAnimationRenderer {
|
||||
self.isPlaying = isPlaying
|
||||
}
|
||||
|
||||
private func animationTick() {
|
||||
let secondsPerFrame = Double(self.frameSkip) / 60.0
|
||||
private func animationTick(frameInterval: Double) {
|
||||
let secondsPerFrame = frameInterval
|
||||
|
||||
var tasks: [LoadFrameGroupTask] = []
|
||||
if let groupContext = self.groupContext {
|
||||
|
Loading…
x
Reference in New Issue
Block a user