mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Adjust blur
This commit is contained in:
@@ -398,16 +398,22 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let propertyAnimator = self.propertyAnimator {
|
if #available(iOS 10.0, *) {
|
||||||
|
self.propertyAnimator = UIViewPropertyAnimator(duration: 0.2, curve: .easeInOut, animations: { [weak self] in
|
||||||
|
self?.effectView.effect = nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if let _ = self.propertyAnimator {
|
||||||
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
|
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
|
||||||
self.displayLinkAnimator = DisplayLinkAnimator(duration: 0.2 * animationDurationFactor, from: (propertyAnimator as? UIViewPropertyAnimator)?.fractionComplete ?? 0.2, to: 0.0, update: { [weak self] value in
|
self.displayLinkAnimator = DisplayLinkAnimator(duration: 0.2 * animationDurationFactor, from: 0.0, to: 0.999, update: { [weak self] value in
|
||||||
(self?.propertyAnimator as? UIViewPropertyAnimator)?.fractionComplete = value
|
(self?.propertyAnimator as? UIViewPropertyAnimator)?.fractionComplete = value
|
||||||
}, completion: { [weak self] in
|
}, completion: {
|
||||||
self?.effectView.isHidden = true
|
|
||||||
completedEffect = true
|
completedEffect = true
|
||||||
intermediateCompletion()
|
intermediateCompletion()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
self.effectView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.05 * animationDurationFactor, delay: 0.15, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, removeOnCompletion: false)
|
||||||
} else {
|
} else {
|
||||||
UIView.animate(withDuration: 0.21 * animationDurationFactor, animations: {
|
UIView.animate(withDuration: 0.21 * animationDurationFactor, animations: {
|
||||||
if #available(iOS 9.0, *) {
|
if #available(iOS 9.0, *) {
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ CGFloat springAnimationValueAt(CABasicAnimation * _Nonnull animation, CGFloat t)
|
|||||||
return [(CASpringAnimation *)animation valueAt:t];
|
return [(CASpringAnimation *)animation valueAt:t];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@interface CustomBlurEffect : UIBlurEffect
|
@interface CustomBlurEffect : UIBlurEffect
|
||||||
|
|
||||||
@property (nonatomic) double blurRadius;
|
/*@property (nonatomic) double blurRadius;
|
||||||
@property (nonatomic) double colorBurnTintAlpha;
|
@property (nonatomic) double colorBurnTintAlpha;
|
||||||
@property (nonatomic) double colorBurnTintLevel;
|
@property (nonatomic) double colorBurnTintLevel;
|
||||||
@property (nonatomic, retain) UIColor *colorTint;
|
@property (nonatomic, retain) UIColor *colorTint;
|
||||||
@@ -104,32 +104,73 @@ CGFloat springAnimationValueAt(CABasicAnimation * _Nonnull animation, CGFloat t)
|
|||||||
@property (nonatomic) bool lightenGrayscaleWithSourceOver;
|
@property (nonatomic) bool lightenGrayscaleWithSourceOver;
|
||||||
@property (nonatomic) double saturationDeltaFactor;
|
@property (nonatomic) double saturationDeltaFactor;
|
||||||
@property (nonatomic) double scale;
|
@property (nonatomic) double scale;
|
||||||
@property (nonatomic) double zoom;
|
@property (nonatomic) double zoom;*/
|
||||||
|
|
||||||
+ (id)effectWithStyle:(long long)arg1;
|
+ (id)effectWithStyle:(long long)arg1;
|
||||||
|
|
||||||
@end*/
|
@end
|
||||||
|
|
||||||
void testZoomBlurEffect(UIVisualEffect *effect) {
|
void testZoomBlurEffect(UIVisualEffect *effect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
UIBlurEffect *makeCustomZoomBlurEffect() {
|
static NSString *encodeText(NSString *string, int key) {
|
||||||
return [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];
|
NSMutableString *result = [[NSMutableString alloc] init];
|
||||||
|
|
||||||
/*NSString *string = [@[@"_", @"UI", @"Custom", @"BlurEffect"] componentsJoinedByString:@""];
|
for (int i = 0; i < (int)[string length]; i++) {
|
||||||
CustomBlurEffect *result = (CustomBlurEffect *)[NSClassFromString(string) effectWithStyle:0];
|
unichar c = [string characterAtIndex:i];
|
||||||
result.blurRadius = 18.0;
|
c += key;
|
||||||
result.zoom = 0.015;
|
[result appendString:[NSString stringWithCharacters:&c length:1]];
|
||||||
result.colorTint = nil;
|
|
||||||
result.colorTintAlpha = 0.0;
|
|
||||||
result.darkeningTintAlpha = 0.0;
|
|
||||||
result.grayscaleTintAlpha = 0.0;
|
|
||||||
result.saturationDeltaFactor = 1.0;
|
|
||||||
/*if ([UIScreen mainScreen].scale > 2.5f) {
|
|
||||||
result.scale = 0.25;
|
|
||||||
} else {
|
|
||||||
result.scale = 0.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;*/
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setField(CustomBlurEffect *object, NSString *name, double value) {
|
||||||
|
SEL selector = NSSelectorFromString(name);
|
||||||
|
NSMethodSignature *signature = [[object class] instanceMethodSignatureForSelector:selector];
|
||||||
|
if (signature == nil) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:signature];
|
||||||
|
[inv setSelector:selector];
|
||||||
|
[inv setArgument:&value atIndex:2];
|
||||||
|
[inv setTarget:object];
|
||||||
|
[inv invoke];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setNilField(CustomBlurEffect *object, NSString *name) {
|
||||||
|
SEL selector = NSSelectorFromString(name);
|
||||||
|
NSMethodSignature *signature = [[object class] instanceMethodSignatureForSelector:selector];
|
||||||
|
if (signature == nil) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:signature];
|
||||||
|
[inv setSelector:selector];
|
||||||
|
id value = nil;
|
||||||
|
[inv setArgument:&value atIndex:2];
|
||||||
|
[inv setTarget:object];
|
||||||
|
[inv invoke];
|
||||||
|
}
|
||||||
|
|
||||||
|
UIBlurEffect *makeCustomZoomBlurEffect() {
|
||||||
|
NSString *string = [@[@"_", @"UI", @"Custom", @"BlurEffect"] componentsJoinedByString:@""];
|
||||||
|
CustomBlurEffect *result = (CustomBlurEffect *)[NSClassFromString(string) effectWithStyle:0];
|
||||||
|
|
||||||
|
setField(result, encodeText(@"tfuCmvsSbejvt;", -1), 10.0);
|
||||||
|
setField(result, encodeText(@"tfu[ppn;", -1), 0.015);
|
||||||
|
setNilField(result, encodeText(@"tfuDpmpsUjou;", -1));
|
||||||
|
setField(result, encodeText(@"tfuDpmpsUjouBmqib;", -1), 0.0);
|
||||||
|
setField(result, encodeText(@"tfuEbslfojohUjouBmqib;", -1), 0.0);
|
||||||
|
setField(result, encodeText(@"tfuHsbztdbmfUjouBmqib;", -1), 0.0);
|
||||||
|
setField(result, encodeText(@"tfuTbuvsbujpoEfmubGbdups;", -1), 1.0);
|
||||||
|
|
||||||
|
if ([UIScreen mainScreen].scale > 2.5f) {
|
||||||
|
setField(result, encodeText(@"setScale:", 0), 0.3);
|
||||||
|
} else {
|
||||||
|
setField(result, encodeText(@"setScale:", 0), 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user