facebookarchive /pop
An extensible iOS and OS X animation library, useful for physics-based interactions.
★ 19,502⑂ 2,847👁 0⑃ 146● 255▤ 3
+0
日增长
19,502
stars
2,847
forks
0
watchers
146
prs
255
issues
3
releases
README
!pop Pop is an extensible animation engine for iOS, tvOS, and OS X. In addition to basic static animations, it supports spring and decay dynamic animations, making it useful for building realistic, physics-based interactions. The API allows quick integration with existing Objective-C or Swift codebases and enables the animation of any property on any object. It's a mature and well-tested framework that drives all the animations and transitions in Paper. Installation Pop is available on CocoaPods. Just add the following to your project Podfile: ruby pod 'pop', '~ 1.0' Bugs are first fixed in master and then made available via a designated release. If you tend to live on the bleeding edge, you can use Pop from master with the following Podfile entry: ruby pod 'pop', :git = 'https://github.com/facebook/pop.git' Framework (manual) By adding the project to your project and adding pop.embedded framework to the Embedded Binaries section on the General tab of your app's target, you can set up pop in seconds! This also enables @import pop syntax with header modules. Note: because of some awkward limitations with Xcode, embedded binaries must share the same name as the module and must have .framework as an extension. This means that you'll see three pop.frameworks when adding embedded binaries (one for OS X, one for tvOS, and one for iOS). You'll need to be sure to add the right one; they appear identically in the list but note the list is populated in order of targets. You can verify the correct one was chosen by checking the path next to the framework listed, in the format - (e.g. Debug-iphoneos). !Embedded Binaries Note 2: this method does not currently play nicely with workspaces. Since targets can only depend on and embed products from other targets in the same project, it only works when pop.xcodeproj is added as a subproject to the current target's project. Otherwise, you'll need to manually set the build ordering in the scheme and copy in the product. Static Library (manual) Alternatively, you can add the project to your workspace and adopt the provided configuration files or manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including -lc++ to your project linker flags. Usage Pop adopts the Core Animation explicit animation programming model. Use by including the following import: Objective-C objective-c import or if you're using the embedded framework: objective-c @import pop; Swift swift import pop Start, Stop & Update To start an animation, add it to the object you wish to animate: Objective-C objective-c POPSpringAnimation anim = [POPSpringAnimation animation]; ... [layer pop_addAnimation:anim forKey:@"myKey"]; Swift swift let anim = POPSpringAnimation() ... layer.pop_add(anim, forKey: "myKey") To stop an animation, remove it from the object referencing the key specified on start: Objective-C objective-c
Top issues
#28support for animating CGPathRef properties27 comments · 2014-04-29#34Provide a way to chain animations17 comments · 2014-04-30#131The occasional POPSpringAnimation doesn't animate where fromValue = toValue15 comments · 2014-07-16#68Improve support for 3rd party animatable properties12 comments · 2014-05-12#47Pop Animation Bug - Locks Up Animation - Intermittent Working Behavior 9 comments · 2014-05-02#310use pop as a dependency of a custom pod will not compile8 comments · 2016-02-26#175Rollback animation support7 comments · 2014-10-18#351pod install 后,怎么运行demo呢? workspace打开也不能运行5 comments · 2017-02-10