mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 11:23:48 +00:00
Fix video chat action button tint transition
This commit is contained in:
parent
3d509c7bda
commit
b712754820
@ -1189,6 +1189,27 @@ public struct ComponentTransition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func animateTintColor(layer: CALayer, from: UIColor, to: UIColor, completion: ((Bool) -> Void)? = nil) {
|
||||||
|
switch self.animation {
|
||||||
|
case .none:
|
||||||
|
completion?(true)
|
||||||
|
case let .curve(duration, curve):
|
||||||
|
let previousColor: CGColor = from.cgColor
|
||||||
|
|
||||||
|
layer.animate(
|
||||||
|
from: previousColor,
|
||||||
|
to: to.cgColor,
|
||||||
|
keyPath: "contentsMultiplyColor",
|
||||||
|
duration: duration,
|
||||||
|
delay: 0.0,
|
||||||
|
curve: curve,
|
||||||
|
removeOnCompletion: true,
|
||||||
|
additive: false,
|
||||||
|
completion: completion
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public func setGradientColors(layer: CAGradientLayer, colors: [UIColor], completion: ((Bool) -> Void)? = nil) {
|
public func setGradientColors(layer: CAGradientLayer, colors: [UIColor], completion: ((Bool) -> Void)? = nil) {
|
||||||
if let current = layer.colors {
|
if let current = layer.colors {
|
||||||
if current.count == colors.count {
|
if current.count == colors.count {
|
||||||
|
@ -267,7 +267,11 @@ final class VideoChatActionButtonComponent: Component {
|
|||||||
} else {
|
} else {
|
||||||
tintTransition = .immediate
|
tintTransition = .immediate
|
||||||
}
|
}
|
||||||
tintTransition.setTintColor(layer: self.background.layer, color: backgroundColor)
|
let previousTintColor = self.background.tintColor
|
||||||
|
self.background.tintColor = backgroundColor
|
||||||
|
if let previousTintColor, previousTintColor != backgroundColor {
|
||||||
|
tintTransition.animateTintColor(layer: self.background.layer, from: previousTintColor, to: backgroundColor)
|
||||||
|
}
|
||||||
|
|
||||||
let titleFrame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) * 0.5), y: size.height + 8.0), size: titleSize)
|
let titleFrame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) * 0.5), y: size.height + 8.0), size: titleSize)
|
||||||
if let titleView = self.title.view {
|
if let titleView = self.title.view {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user