Chapter 43 - Polish the Pop-Up Background View Ripple Effect

When we dismiss the pop-up detail it fades out with a sort of ripple effect. This looks nice when we animate the pop up to display, but when dismissing it, that seems kind of out place. It would make more sense if the detail pop up goes in the same direction of the background view so in this case, the detail pop up could zoom into towards the center of the screen following the direction of the circular ripple effect which I have figured out how to do.

My question is, how could we change the animation of the background view when we dismiss the background gradient view? So instead of a fade-out ripple effect, how could we go about having a different type of animation like a normal fade out?

Hi @mcneils, here is a snippet of code that could possibly provide your UIView with a fade out.

func fadeViewInThenOut(view : UIView, delay: TimeInterval) {

    let animationDuration = 1.5

    UIView.animate(withDuration: animationDuration, delay: delay, options: [UIView.AnimationOptions.autoreverse, UIView.AnimationOptions.repeat], animations: {
        view.alpha = 0
    }, completion: nil)

}

This topic was automatically closed after 166 days. New replies are no longer allowed.