用 Swift 实现的动画框架:RazzleDazzle
IFTTT 开源了一个用 Swift 实现的动画框架,非常合适用在 App 的初次展示上。
RazzleDazzleis a simple AutoLayout-friendly keyframe animation framework for iOS, written in Swift. Perfect for scrolling app intros.
RazzleDazzlegrew from JazzHands, an Objective-C scrolling keyframe animations library by IFTTT.
JazzHands is used extensively in IF and DO for iPhone and iPad, most famously in the app intro.
What'sRazzleDazzlefor?
Scrolling App Intro Animations
RazzleDazzleis the easiest way to add scrollview-powered animations to the app intro of your Swift app. If you're adding a scrolling intro to your Objective-C app, check out JazzHands!
For some examples of how JazzHands andRazzleDazzlecan be used in practice, check out the intros of both IF and DO for iPhone and iPad, as well as the scrolling animations of the buttons in the DO apps by IFTTT.
Easy Paging Scrollview Layouts in an AutoLayout World
RazzleDazzle'skeep(view: onPage:)function of theAnimatedPagingScrollViewControlleris a super easy way to lay out a paging scroll view that does what you expect it to when your app is rotated or used in the new split-screen iPad views of iOS9, a notoriously tricky aspect of getting your apps fully AutoLayout-ready.RazzleDazzlesets up an AutoLayout-friendly paging scroll view controller for you, and all you need to do to make your layout respond properly to any view size changes is tellRazzleDazzlewhich page you'd like things on.
As a bonus, because it's built on top of the animations library, you can even tellRazzleDazzlethat you'd like one of your views to show up on multiple pages while other views scroll past, with a single call tokeep(view: onPages:).
Installation
Carthage
RazzleDazzleis available through Carthage. To install it, simply add the following line to yourCartfile:
github "IFTTT/RazzleDazzle"
CocoaPods
RazzleDazzleis also available through CocoaPods. To install it, simply add the following line to yourPodfile:
pod "RazzleDazzle"
BecauseRazzleDazzleis written in Swift, be sure to adduse_frameworks!at the top of your Podfile.
source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! pod 'RazzleDazzle'