alexhillc / AXPhotoViewer

An iOS/tvOS photo gallery viewer, useful for viewing a large (or small!) number of photos.
https://www.cocoacontrols.com/controls/axphotoviewer
MIT License
646 stars 119 forks source link

Feature request: A flag for enable / disable the caption view's text animation during the swipe #7

Closed deepmode closed 7 years ago

deepmode commented 7 years ago

@alexhillc A feature request regarding the caption text animation during the swipe left / right. Right now, the caption text (title, description and credit) are animating when going from one photo to another. This is a kind of un-natural (fading in and out) especially when the list of photos share the same description. One suggestion is to have a flag which we can set to enable the caption text animation during the swipe action. e.g.

       // should be a public property  
       let animateCaptionDuringSwipe = false.  

        if animateCaptionDuringSwipe {
            self.isCaptionAnimatingOut = true
            UIView.animate(withDuration: Constants.frameAnimDuration / 2,
                           delay: 0,
                           options: [.beginFromCurrentState, .curveEaseOut], 
                           animations: animateOut) { [weak self] (finished) in

                guard let uSelf = self, !uSelf.isCaptionAnimatingIn else {
                    return
                }

                animateOutCompletion(finished)
                UIView.animate(withDuration: Constants.frameAnimDuration / 2, 
                               delay: 0, 
                               options: [.beginFromCurrentState, .curveEaseIn], 
                               animations: animateIn, 
                               completion: animateInCompletion)
            }
        } else {
            animateOutCompletion(true)
        }
alexhillc commented 7 years ago

👍 added in: d75a48815512c53340b3fefe1c1abb1cd13dfa79 To access, just use PhotosViewController.overlayView.animateCaptionViewChanges