mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
Adding proper "live" animation
This commit is contained in:
parent
a7e24996d8
commit
81ee64d2ec
@ -63,7 +63,7 @@ public final class AnimatedCountView: UIView {
|
||||
// } else {
|
||||
// self.countLabel.attributedText = NSAttributedString(string: text, attributes: [.font: UIFont.systemFont(ofSize: 54, weight: .semibold)])
|
||||
// }
|
||||
self.countLabel.attributedText = NSAttributedString(string: text, attributes: [.font: UIFont.systemFont(ofSize: 60, weight: .semibold)])
|
||||
self.countLabel.attributedText = NSAttributedString(string: text, font: Font.with(size: 60.0, design: .round, weight: .semibold, traits: [.monospacedNumbers]), textColor: .white)
|
||||
// self.countLabel.attributedText = NSAttributedString(string: text, attributes: [.font: UIFont.systemFont(ofSize: 60, weight: .semibold)])
|
||||
// var timerSize = self.timerNode.updateLayout(CGSize(width: size.width + 100.0, height: size.height))
|
||||
// if timerSize.width > size.width - 32.0 {
|
||||
|
||||
@ -83,14 +83,20 @@ final class StreamTitleComponent: Component {
|
||||
// TODO: animate
|
||||
wasLive = true
|
||||
// let frame = self.frame
|
||||
let anim = CAKeyframeAnimation(keyPath: "transform.scale")
|
||||
anim.values = [1.0, 1.4, 1.0]
|
||||
anim.keyTimes = [0, 0.5, 1]
|
||||
self.layer.add(anim, forKey: "transform")
|
||||
|
||||
// UIView.transition(with: self, duration: <#T##TimeInterval#>, animations: <#T##(() -> Void)?##(() -> Void)?##() -> Void#>)
|
||||
UIView.animate(withDuration: 0.15, animations: {
|
||||
self.toggle(isLive: true)
|
||||
self.transform = .init(scaleX: 1.5, y: 1.5)
|
||||
// self.transform = .init(scaleX: 1.5, y: 1.5)
|
||||
}, completion: { _ in
|
||||
UIView.animate(withDuration: 0.15) {
|
||||
self.transform = .identity
|
||||
// self.frame = frame
|
||||
}
|
||||
// UIView.animate(withDuration: 0.15) {
|
||||
// self.transform = .identity
|
||||
//// self.frame = frame
|
||||
// }
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user