12345678910111213141516171819202122232425262728293031 |
- //
- // YMCustomEffectView.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/3/2.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMCustomEffectView.h"
- @interface YMCustomEffectView ()
- @end
- @implementation YMCustomEffectView
- - (instancetype)initWithEffect:(UIVisualEffect *)effect intensity:(CGFloat)intensity {
- if (self = [super initWithEffect:nil]) {
- self.effect = nil;
- self.intensity = intensity;
- self.animator = [[UIViewPropertyAnimator alloc] initWithDuration:1 curve:UIViewAnimationCurveLinear animations:^{
- self.effect = effect;
- }];
-
- self.animator.fractionComplete = self.intensity;
- if (@available(iOS 11.0, *)) {
- self.animator.pausesOnCompletion = YES;
- }
- }
- return self;
- }
- @end
|