mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-17 03:40:18 +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 {
|
// } 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: 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)])
|
// 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))
|
// var timerSize = self.timerNode.updateLayout(CGSize(width: size.width + 100.0, height: size.height))
|
||||||
// if timerSize.width > size.width - 32.0 {
|
// if timerSize.width > size.width - 32.0 {
|
||||||
|
|||||||
@ -83,14 +83,20 @@ final class StreamTitleComponent: Component {
|
|||||||
// TODO: animate
|
// TODO: animate
|
||||||
wasLive = true
|
wasLive = true
|
||||||
// let frame = self.frame
|
// 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: {
|
UIView.animate(withDuration: 0.15, animations: {
|
||||||
self.toggle(isLive: true)
|
self.toggle(isLive: true)
|
||||||
self.transform = .init(scaleX: 1.5, y: 1.5)
|
// self.transform = .init(scaleX: 1.5, y: 1.5)
|
||||||
}, completion: { _ in
|
}, completion: { _ in
|
||||||
UIView.animate(withDuration: 0.15) {
|
// UIView.animate(withDuration: 0.15) {
|
||||||
self.transform = .identity
|
// self.transform = .identity
|
||||||
// self.frame = frame
|
//// self.frame = frame
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user