@@ -68,16 +68,24 @@ import UIKit
6868 let blurEffect = UIBlurEffect ( style: style)
6969 let vibrancyEffect = UIVibrancyEffect ( blurEffect: blurEffect)
7070
71- // Use animator to control blur intensity
72- blurAnimator = UIViewPropertyAnimator ( duration: 1 , curve: . linear)
73- blurAnimator? . addAnimations { [ weak self] in
74- self ? . blurEffectView. effect = blurEffect
75- self ? . vibrancyEffectView. effect = vibrancyEffect
71+ // Set effects directly first to ensure they are visible
72+ // Animating them from nil often causes issues with UIVibrancyEffect
73+ blurEffectView. effect = blurEffect
74+ vibrancyEffectView. effect = vibrancyEffect
75+
76+ // Create animator to adjust intensity
77+ blurAnimator = UIViewPropertyAnimator ( duration: 1 , curve: . linear) { [ weak self] in
78+ self ? . blurEffectView. effect = nil
79+ self ? . vibrancyEffectView. effect = nil
7680 }
7781
7882 // Convert blurAmount (0-100) to intensity (0.0-1.0)
83+ // We reverse the logic:
84+ // fractionComplete = 0.0 -> effects are fully applied (start state)
85+ // fractionComplete = 1.0 -> effects are removed (end state)
86+ // So to get desired intensity X, we set fractionComplete to (1 - X)
7987 let intensity = min ( max ( blurAmount / 100.0 , 0.0 ) , 1.0 )
80- blurAnimator? . fractionComplete = intensity
88+ blurAnimator? . fractionComplete = 1.0 - intensity
8189
8290 // Stop the animation at the current state
8391 DispatchQueue . main. async { [ weak self, weak blurAnimator] in
0 commit comments