ealeksandrov / EAIntroView

Highly customizable drop-in solution for introduction views.
MIT License
3.76k stars 501 forks source link

Adds new delegate method: intro:didScrollWithOffset: #179

Closed JakeSc closed 8 years ago

JakeSc commented 8 years ago

I'm using this to accomplish some scroll-based fade animations. Here's some sample code:

    func intro(introView: EAIntroView!, didScrollWithOffset offset: CGFloat) {
        // Update the opacity of the calloutView

        let currentPageIndex = CGFloat(introView.currentPageIndex)

        let alpha: CGFloat
        if offset > currentPageIndex {
            alpha = 1 - (offset - currentPageIndex)
        } else {
            alpha = 1 - (currentPageIndex - offset)
        }

        currentCalloutView?.alpha = alpha
    }