mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Use timer for animation
This commit is contained in:
parent
51c0888313
commit
83e3b3bd6c
1 changed files with 5 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue