I'm trying to animate a blur effect up until a certain intensity. Doing so using the .animate
method of UIView
is trivial:
let visualEffectView = UIVisualEffectView(effect: nil)
UIView.animate(withDuration: 1) {
visualEffectView.effect = UIBlurEffect(style: .regular)
}
, the issue here is that the final blur intensity is way too high to my needs. Does anyone know if there is another way to achieve a similar result, reducing the final blur intensity?
Some approaches i can think of:
- animating the
alpha
property, but apparently Apple advices against it; - using
UIViewPropertyAnimator
and stopping the animation midway, but i've tried to search for a way to achieve this without success. The best thing i can think of is to start it and then pause it halfway its duration by using a timer, but it looks like a very bad practice to me.