├── Podfile ├── Podfile.lock ├── Pods ├── Headers │ ├── Private │ │ └── pop │ │ │ ├── FloatConversion.h │ │ │ ├── POP.h │ │ │ ├── POPAction.h │ │ │ ├── POPAnimatableProperty.h │ │ │ ├── POPAnimation.h │ │ │ ├── POPAnimationEvent.h │ │ │ ├── POPAnimationEventInternal.h │ │ │ ├── POPAnimationExtras.h │ │ │ ├── POPAnimationInternal.h │ │ │ ├── POPAnimationPrivate.h │ │ │ ├── POPAnimationRuntime.h │ │ │ ├── POPAnimationTracer.h │ │ │ ├── POPAnimationTracerInternal.h │ │ │ ├── POPAnimator.h │ │ │ ├── POPAnimatorPrivate.h │ │ │ ├── POPBasicAnimation.h │ │ │ ├── POPBasicAnimationInternal.h │ │ │ ├── POPCGUtils.h │ │ │ ├── POPCustomAnimation.h │ │ │ ├── POPDecayAnimation.h │ │ │ ├── POPDecayAnimationInternal.h │ │ │ ├── POPDefines.h │ │ │ ├── POPGeometry.h │ │ │ ├── POPLayerExtras.h │ │ │ ├── POPMath.h │ │ │ ├── POPPropertyAnimation.h │ │ │ ├── POPPropertyAnimationInternal.h │ │ │ ├── POPSpringAnimation.h │ │ │ ├── POPSpringAnimationInternal.h │ │ │ ├── POPSpringSolver.h │ │ │ ├── POPVector.h │ │ │ ├── TransformationMatrix.h │ │ │ └── UnitBezier.h │ └── Public │ │ └── pop │ │ ├── POP.h │ │ ├── POPAnimatableProperty.h │ │ ├── POPAnimation.h │ │ ├── POPAnimationEvent.h │ │ ├── POPAnimationExtras.h │ │ ├── POPAnimationTracer.h │ │ ├── POPAnimator.h │ │ ├── POPBasicAnimation.h │ │ ├── POPCustomAnimation.h │ │ ├── POPDecayAnimation.h │ │ ├── POPDefines.h │ │ ├── POPGeometry.h │ │ ├── POPLayerExtras.h │ │ ├── POPPropertyAnimation.h │ │ └── POPSpringAnimation.h ├── Manifest.lock ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── macOne.xcuserdatad │ │ └── xcschemes │ │ ├── Pods.xcscheme │ │ ├── pop.xcscheme │ │ └── xcschememanagement.plist ├── Target Support Files │ ├── Pods │ │ ├── Pods-acknowledgements.markdown │ │ ├── Pods-acknowledgements.plist │ │ ├── Pods-dummy.m │ │ ├── Pods-frameworks.sh │ │ ├── Pods-resources.sh │ │ ├── Pods.debug.xcconfig │ │ └── Pods.release.xcconfig │ └── pop │ │ ├── pop-dummy.m │ │ ├── pop-prefix.pch │ │ └── pop.xcconfig └── pop │ ├── LICENSE │ ├── README.md │ └── pop │ ├── POP.h │ ├── POPAction.h │ ├── POPAnimatableProperty.h │ ├── POPAnimatableProperty.mm │ ├── POPAnimation.h │ ├── POPAnimation.mm │ ├── POPAnimationEvent.h │ ├── POPAnimationEvent.mm │ ├── POPAnimationEventInternal.h │ ├── POPAnimationExtras.h │ ├── POPAnimationExtras.mm │ ├── POPAnimationInternal.h │ ├── POPAnimationPrivate.h │ ├── POPAnimationRuntime.h │ ├── POPAnimationRuntime.mm │ ├── POPAnimationTracer.h │ ├── POPAnimationTracer.mm │ ├── POPAnimationTracerInternal.h │ ├── POPAnimator.h │ ├── POPAnimator.mm │ ├── POPAnimatorPrivate.h │ ├── POPBasicAnimation.h │ ├── POPBasicAnimation.mm │ ├── POPBasicAnimationInternal.h │ ├── POPCGUtils.h │ ├── POPCGUtils.mm │ ├── POPCustomAnimation.h │ ├── POPCustomAnimation.mm │ ├── POPDecayAnimation.h │ ├── POPDecayAnimation.mm │ ├── POPDecayAnimationInternal.h │ ├── POPDefines.h │ ├── POPGeometry.h │ ├── POPGeometry.mm │ ├── POPLayerExtras.h │ ├── POPLayerExtras.mm │ ├── POPMath.h │ ├── POPMath.mm │ ├── POPPropertyAnimation.h │ ├── POPPropertyAnimation.mm │ ├── POPPropertyAnimationInternal.h │ ├── POPSpringAnimation.h │ ├── POPSpringAnimation.mm │ ├── POPSpringAnimationInternal.h │ ├── POPSpringSolver.h │ ├── POPVector.h │ ├── POPVector.mm │ └── WebCore │ ├── FloatConversion.h │ ├── TransformationMatrix.cpp │ ├── TransformationMatrix.h │ └── UnitBezier.h ├── README.md ├── ZFCityGuides.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── macOne.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── macOne.xcuserdatad │ └── xcschemes │ ├── ZFCityGuides.xcscheme │ └── xcschememanagement.plist ├── ZFCityGuides.xcworkspace ├── contents.xcworkspacedata └── xcuserdata │ └── macOne.xcuserdatad │ ├── UserInterfaceState.xcuserstate │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist └── ZFCityGuides ├── AnimationControllers ├── NavigationAnimationViewController.h ├── NavigationAnimationViewController.m ├── PresentAnimationController.h ├── PresentAnimationController.m ├── TabBarAnimationController.h └── TabBarAnimationController.m ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Category ├── UIImage+UIColor.h ├── UIImage+UIColor.m ├── UINavigationController+Interactive.h └── UINavigationController+Interactive.m ├── ConstantValue.h ├── GlobalFunction.h ├── GlobalFunction.m ├── Info.plist ├── NavigationController ├── MainNavigationController.h ├── MainNavigationController.m ├── UINavigationController+Interactive.h └── UINavigationController+Interactive.m ├── ZFCityGuides-Prefix.pch ├── ZFGradientView.h ├── ZFGradientView.m ├── ZFLayoutButton.h ├── ZFLayoutButton.m ├── ZFRainDropView.h ├── ZFRainDropView.m ├── ZFScrollView ├── ZFScrollViewCell.h ├── ZFScrollViewCell.m ├── ZFTransformScrollView.h └── ZFTransformScrollView.m ├── ZFSegmentedControl.h ├── ZFSegmentedControl.m ├── ZFSliderAnimationView.h ├── ZFSliderAnimationView.m ├── font ├── FilmotypeGiant.otf ├── TrumpGothicEast-Bold.ttf └── TrumpGothicEast.ttf ├── images ├── ZFCityGuides-stats.gif ├── about-icon.png ├── about-icon@2x.png ├── back@2x.png ├── beijing.jpg ├── card.jpg ├── essentials-icon.png ├── essentials-icon@2x.png ├── guangzhou.jpg ├── hongkong.jpg ├── layout_grid@2x.png ├── layout_slider@2x.png ├── location.jpg ├── logo.png ├── main-menu-iphone-dyk-selected.png ├── main-menu-iphone-dyk-selected@2x.png ├── main-menu-iphone-dyk.png ├── main-menu-iphone-dyk@2x.png ├── main-menu-iphone-essentials-selected.png ├── main-menu-iphone-essentials-selected@2x.png ├── main-menu-iphone-essentials.png ├── main-menu-iphone-essentials@2x.png ├── main-menu-iphone-favorites-selected.png ├── main-menu-iphone-favorites-selected@2x.png ├── main-menu-iphone-favorites.png ├── main-menu-iphone-favorites@2x.png ├── main-menu-iphone-food-selected.png ├── main-menu-iphone-food-selected@2x.png ├── main-menu-iphone-food.png ├── main-menu-iphone-food@2x.png ├── main-menu-iphone-itineraries-selected.png ├── main-menu-iphone-itineraries-selected@2x.png ├── main-menu-iphone-itineraries.png ├── main-menu-iphone-itineraries@2x.png ├── main-menu-iphone-photos-selected.png ├── main-menu-iphone-photos-selected@2x.png ├── main-menu-iphone-photos.png ├── main-menu-iphone-photos@2x.png ├── main-menu-iphone-search-selected.png ├── main-menu-iphone-search-selected@2x.png ├── main-menu-iphone-search.png ├── main-menu-iphone-search@2x.png ├── main-menu-iphone-secrets-selected.png ├── main-menu-iphone-secrets-selected@2x.png ├── main-menu-iphone-secrets.png ├── main-menu-iphone-secrets@2x.png ├── main-menu-iphone-settings-selected.png ├── main-menu-iphone-settings-selected@2x.png ├── main-menu-iphone-settings.png ├── main-menu-iphone-settings@2x.png ├── main-menu-iphone-walks-selected.png ├── main-menu-iphone-walks-selected@2x.png ├── main-menu-iphone-walks.png ├── main-menu-iphone-walks@2x.png ├── main-menu-iphone-weather-selected.png ├── main-menu-iphone-weather-selected@2x.png ├── main-menu-iphone-weather.png ├── main-menu-iphone-weather@2x.png ├── main-menu-iphone-wtd-selected.png ├── main-menu-iphone-wtd-selected@2x.png ├── main-menu-iphone-wtd.png ├── main-menu-iphone-wtd@2x.png ├── main-menu-toggle-arrow-iphone.png ├── main-menu-toggle-arrow-iphone@2x.png ├── news-icon.png ├── news-icon@2x.png ├── photo.jpg ├── secret.jpg ├── shanghai.jpg ├── statistics-hero.png ├── statistics-hero@2x.png ├── statistics-raindrop-blue.png ├── statistics-raindrop-blue@2x.png ├── statistics-raindrop-yellow.png ├── statistics-raindrop-yellow@2x.png ├── statistics-woman.png ├── statistics-woman@2x.png └── walk.jpg ├── interactiveController ├── ZFInteractiveTransition.h ├── ZFInteractiveTransition.m ├── ZFNavInteractiveTransition.h └── ZFNavInteractiveTransition.m ├── main.m ├── tabBarContoller ├── TabBarItemCell.h ├── TabBarItemCell.m ├── ZFMainTabBarController.h └── ZFMainTabBarController.m └── viewControllers ├── BaseViewController.h ├── BaseViewController.m ├── EssentialsViewController.h ├── EssentialsViewController.m ├── MainViewController.h ├── MainViewController.m ├── StatsViewController.h └── StatsViewController.m /Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs' 2 | 3 | platform :ios, "7.0" 4 | 5 | pod "pop" 6 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - pop (1.0.8) 3 | 4 | DEPENDENCIES: 5 | - pop 6 | 7 | SPEC CHECKSUMS: 8 | pop: bb773ae2c791ca2629de13b347e7a8b450fa6a57 9 | 10 | COCOAPODS: 0.39.0 11 | -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/FloatConversion.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/WebCore/FloatConversion.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POP.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POP.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAction.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAction.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimatableProperty.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimatableProperty.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimationEvent.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationEvent.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimationEventInternal.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationEventInternal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimationExtras.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationExtras.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimationInternal.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationInternal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimationPrivate.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationPrivate.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimationRuntime.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationRuntime.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimationTracer.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationTracer.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimationTracerInternal.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationTracerInternal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimator.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimator.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPAnimatorPrivate.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimatorPrivate.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPBasicAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPBasicAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPBasicAnimationInternal.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPBasicAnimationInternal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPCGUtils.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPCGUtils.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPCustomAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPCustomAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPDecayAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPDecayAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPDecayAnimationInternal.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPDecayAnimationInternal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPDefines.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPDefines.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPGeometry.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPGeometry.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPLayerExtras.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPLayerExtras.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPMath.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPMath.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPPropertyAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPPropertyAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPPropertyAnimationInternal.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPPropertyAnimationInternal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPSpringAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPSpringAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPSpringAnimationInternal.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPSpringAnimationInternal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPSpringSolver.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPSpringSolver.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/POPVector.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPVector.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/TransformationMatrix.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/WebCore/TransformationMatrix.h -------------------------------------------------------------------------------- /Pods/Headers/Private/pop/UnitBezier.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/WebCore/UnitBezier.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POP.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POP.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPAnimatableProperty.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimatableProperty.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPAnimationEvent.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationEvent.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPAnimationExtras.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationExtras.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPAnimationTracer.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimationTracer.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPAnimator.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPAnimator.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPBasicAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPBasicAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPCustomAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPCustomAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPDecayAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPDecayAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPDefines.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPDefines.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPGeometry.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPGeometry.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPLayerExtras.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPLayerExtras.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPPropertyAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPPropertyAnimation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/pop/POPSpringAnimation.h: -------------------------------------------------------------------------------- 1 | ../../../pop/pop/POPSpringAnimation.h -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - pop (1.0.8) 3 | 4 | DEPENDENCIES: 5 | - pop 6 | 7 | SPEC CHECKSUMS: 8 | pop: bb773ae2c791ca2629de13b347e7a8b450fa6a57 9 | 10 | COCOAPODS: 0.39.0 11 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/macOne.xcuserdatad/xcschemes/Pods.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/macOne.xcuserdatad/xcschemes/pop.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/macOne.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods.xcscheme 8 | 9 | isShown 10 | 11 | 12 | pop.xcscheme 13 | 14 | isShown 15 | 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 7EC2A95DCD367DFEEFF114831B437160 21 | 22 | primary 23 | 24 | 25 | 8391CE7DE5D120327DA6245F4AAB5EFF 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## pop 5 | 6 | BSD License 7 | 8 | For Pop software 9 | 10 | Copyright (c) 2014, Facebook, Inc. All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | * Neither the name Facebook nor the names of its contributors may be used to 23 | endorse or promote products derived from this software without specific 24 | prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 27 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 30 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 33 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | Generated by CocoaPods - http://cocoapods.org 38 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | BSD License 18 | 19 | For Pop software 20 | 21 | Copyright (c) 2014, Facebook, Inc. All rights reserved. 22 | 23 | Redistribution and use in source and binary forms, with or without modification, 24 | are permitted provided that the following conditions are met: 25 | 26 | * Redistributions of source code must retain the above copyright notice, this 27 | list of conditions and the following disclaimer. 28 | 29 | * Redistributions in binary form must reproduce the above copyright notice, 30 | this list of conditions and the following disclaimer in the documentation 31 | and/or other materials provided with the distribution. 32 | 33 | * Neither the name Facebook nor the names of its contributors may be used to 34 | endorse or promote products derived from this software without specific 35 | prior written permission. 36 | 37 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 38 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 39 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 40 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 41 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 42 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 44 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 45 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 46 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 47 | 48 | Title 49 | pop 50 | Type 51 | PSGroupSpecifier 52 | 53 | 54 | FooterText 55 | Generated by CocoaPods - http://cocoapods.org 56 | Title 57 | 58 | Type 59 | PSGroupSpecifier 60 | 61 | 62 | StringsTable 63 | Acknowledgements 64 | Title 65 | Acknowledgements 66 | 67 | 68 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY="$(cd "${1%/*}" && pwd)" 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 63 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 66 | fi 67 | rm -f "$RESOURCES_TO_COPY" 68 | 69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 70 | then 71 | case "${TARGETED_DEVICE_FAMILY}" in 72 | 1,2) 73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 74 | ;; 75 | 1) 76 | TARGET_DEVICE_ARGS="--target-device iphone" 77 | ;; 78 | 2) 79 | TARGET_DEVICE_ARGS="--target-device ipad" 80 | ;; 81 | *) 82 | TARGET_DEVICE_ARGS="--target-device mac" 83 | ;; 84 | esac 85 | 86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 88 | while read line; do 89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 90 | XCASSET_FILES+=("$line") 91 | fi 92 | done <<<"$OTHER_XCASSETS" 93 | 94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/pop" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/pop" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"pop" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/pop" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/pop" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"pop" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/pop/pop-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_pop : NSObject 3 | @end 4 | @implementation PodsDummy_pop 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/pop/pop-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/pop/pop.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_CXX_LANGUAGE_STANDARD = c++11 2 | CLANG_CXX_LIBRARY = libc++ 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/pop" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/pop" 5 | OTHER_LDFLAGS = -l"c++" 6 | PODS_ROOT = ${SRCROOT} 7 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/pop/LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For Pop software 4 | 5 | Copyright (c) 2014, Facebook, Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name Facebook nor the names of its contributors may be used to 18 | endorse or promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /Pods/pop/pop/POP.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #ifndef POP_POP_H 11 | #define POP_POP_H 12 | 13 | #import 14 | 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | 29 | #endif /* POP_POP_H */ 30 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAction.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #ifndef POPACTION_H 11 | #define POPACTION_H 12 | 13 | #import 14 | 15 | #import 16 | 17 | #ifdef __cplusplus 18 | 19 | namespace POP { 20 | 21 | /** 22 | @abstract Disables Core Animation actions using RAII. 23 | @discussion The disablement of actions is scoped to the current transaction. 24 | */ 25 | class ActionDisabler 26 | { 27 | BOOL state; 28 | 29 | public: 30 | ActionDisabler() POP_NOTHROW 31 | { 32 | state = [CATransaction disableActions]; 33 | [CATransaction setDisableActions:YES]; 34 | } 35 | 36 | ~ActionDisabler() 37 | { 38 | [CATransaction setDisableActions:state]; 39 | } 40 | }; 41 | 42 | /** 43 | @abstract Enables Core Animation actions using RAII. 44 | @discussion The enablement of actions is scoped to the current transaction. 45 | */ 46 | class ActionEnabler 47 | { 48 | BOOL state; 49 | 50 | public: 51 | ActionEnabler() POP_NOTHROW 52 | { 53 | state = [CATransaction disableActions]; 54 | [CATransaction setDisableActions:NO]; 55 | } 56 | 57 | ~ActionEnabler() 58 | { 59 | [CATransaction setDisableActions:state]; 60 | } 61 | }; 62 | 63 | } 64 | 65 | #endif /* __cplusplus */ 66 | 67 | #endif /* POPACTION_H */ 68 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimationEvent.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | /** 13 | @abstract Enumeraton of animation event types. 14 | */ 15 | typedef NS_ENUM(NSUInteger, POPAnimationEventType) { 16 | kPOPAnimationEventPropertyRead = 0, 17 | kPOPAnimationEventPropertyWrite, 18 | kPOPAnimationEventToValueUpdate, 19 | kPOPAnimationEventFromValueUpdate, 20 | kPOPAnimationEventVelocityUpdate, 21 | kPOPAnimationEventBouncinessUpdate, 22 | kPOPAnimationEventSpeedUpdate, 23 | kPOPAnimationEventFrictionUpdate, 24 | kPOPAnimationEventMassUpdate, 25 | kPOPAnimationEventTensionUpdate, 26 | kPOPAnimationEventDidStart, 27 | kPOPAnimationEventDidStop, 28 | kPOPAnimationEventDidReachToValue, 29 | kPOPAnimationEventAutoreversed 30 | }; 31 | 32 | /** 33 | @abstract The base animation event class. 34 | */ 35 | @interface POPAnimationEvent : NSObject 36 | 37 | /** 38 | @abstract The event type. See {@ref POPAnimationEventType} for possible values. 39 | */ 40 | @property (readonly, nonatomic, assign) POPAnimationEventType type; 41 | 42 | /** 43 | @abstract The time of event. 44 | */ 45 | @property (readonly, nonatomic, assign) CFTimeInterval time; 46 | 47 | /** 48 | @abstract Optional string describing the animation at time of event. 49 | */ 50 | @property (readonly, nonatomic, copy) NSString *animationDescription; 51 | 52 | @end 53 | 54 | /** 55 | @abstract An animation event subclass for recording value and velocity. 56 | */ 57 | @interface POPAnimationValueEvent : POPAnimationEvent 58 | 59 | /** 60 | @abstract The value recorded. 61 | */ 62 | @property (readonly, nonatomic, strong) id value; 63 | 64 | /** 65 | @abstract The velocity recorded, if any. 66 | */ 67 | @property (readonly, nonatomic, strong) id velocity; 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimationEvent.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPAnimationEvent.h" 11 | #import "POPAnimationEventInternal.h" 12 | 13 | static NSString *stringFromType(POPAnimationEventType aType) 14 | { 15 | switch (aType) { 16 | case kPOPAnimationEventPropertyRead: 17 | return @"read"; 18 | case kPOPAnimationEventPropertyWrite: 19 | return @"write"; 20 | case kPOPAnimationEventToValueUpdate: 21 | return @"toValue"; 22 | case kPOPAnimationEventFromValueUpdate: 23 | return @"fromValue"; 24 | case kPOPAnimationEventVelocityUpdate: 25 | return @"velocity"; 26 | case kPOPAnimationEventSpeedUpdate: 27 | return @"speed"; 28 | case kPOPAnimationEventBouncinessUpdate: 29 | return @"bounciness"; 30 | case kPOPAnimationEventFrictionUpdate: 31 | return @"friction"; 32 | case kPOPAnimationEventMassUpdate: 33 | return @"mass"; 34 | case kPOPAnimationEventTensionUpdate: 35 | return @"tension"; 36 | case kPOPAnimationEventDidStart: 37 | return @"didStart"; 38 | case kPOPAnimationEventDidStop: 39 | return @"didStop"; 40 | case kPOPAnimationEventDidReachToValue: 41 | return @"didReachToValue"; 42 | case kPOPAnimationEventAutoreversed: 43 | return @"autoreversed"; 44 | default: 45 | return nil; 46 | } 47 | } 48 | 49 | @implementation POPAnimationEvent 50 | @synthesize type = _type; 51 | @synthesize time = _time; 52 | @synthesize animationDescription = _animationDescription; 53 | 54 | - (instancetype)initWithType:(POPAnimationEventType)aType time:(CFTimeInterval)aTime 55 | { 56 | self = [super init]; 57 | if (nil != self) { 58 | _type = aType; 59 | _time = aTime; 60 | } 61 | return self; 62 | } 63 | 64 | - (NSString *)description 65 | { 66 | NSMutableString *s = [NSMutableString stringWithFormat:@""]; 69 | return s; 70 | } 71 | 72 | // subclass override 73 | - (void)_appendDescription:(NSMutableString *)s 74 | { 75 | if (0 != _animationDescription.length) { 76 | [s appendFormat:@"; animation = %@", _animationDescription]; 77 | } 78 | } 79 | 80 | @end 81 | 82 | @implementation POPAnimationValueEvent 83 | @synthesize value = _value; 84 | @synthesize velocity = _velocity; 85 | 86 | - (instancetype)initWithType:(POPAnimationEventType)aType time:(CFTimeInterval)aTime value:(id)aValue 87 | { 88 | self = [self initWithType:aType time:aTime]; 89 | if (nil != self) { 90 | _value = aValue; 91 | } 92 | return self; 93 | } 94 | 95 | - (void)_appendDescription:(NSMutableString *)s 96 | { 97 | [super _appendDescription:s]; 98 | 99 | if (nil != _value) { 100 | [s appendFormat:@"; value = %@", _value]; 101 | } 102 | 103 | if (nil != _velocity) { 104 | [s appendFormat:@"; velocity = %@", _velocity]; 105 | } 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimationEventInternal.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "POPAnimationEvent.h" 13 | 14 | @interface POPAnimationEvent () 15 | 16 | /** 17 | @abstract Default initializer. 18 | */ 19 | - (instancetype)initWithType:(POPAnimationEventType)type time:(CFTimeInterval)time; 20 | 21 | /** 22 | @abstract Readwrite redefinition of public property. 23 | */ 24 | @property (readwrite, nonatomic, copy) NSString *animationDescription; 25 | 26 | @end 27 | 28 | @interface POPAnimationValueEvent () 29 | 30 | /** 31 | @abstract Default initializer. 32 | */ 33 | - (instancetype)initWithType:(POPAnimationEventType)type time:(CFTimeInterval)time value:(id)value; 34 | 35 | /** 36 | @abstract Readwrite redefinition of public property. 37 | */ 38 | @property (readwrite, nonatomic, strong) id velocity; 39 | 40 | @end 41 | 42 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimationExtras.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | #import 14 | 15 | /** 16 | @abstract The current drag coefficient. 17 | @discussion A value greater than 1.0 indicates Simulator slow-motion animations are enabled. Defaults to 1.0. 18 | */ 19 | extern CGFloat POPAnimationDragCoefficient(); 20 | 21 | @interface CAAnimation (POPAnimationExtras) 22 | 23 | /** 24 | @abstract Apply the current drag coefficient to animation speed. 25 | @discussion Convenience utility to respect Simulator slow-motion animation settings. 26 | */ 27 | - (void)pop_applyDragCoefficient; 28 | 29 | @end 30 | 31 | @interface POPSpringAnimation (POPAnimationExtras) 32 | 33 | /** 34 | @abstract Converts from spring bounciness and speed to tension, friction and mass dynamics values. 35 | */ 36 | + (void)convertBounciness:(CGFloat)bounciness speed:(CGFloat)speed toTension:(CGFloat *)outTension friction:(CGFloat *)outFriction mass:(CGFloat *)outMass; 37 | 38 | /** 39 | @abstract Converts from dynamics tension, friction and mass to spring bounciness and speed values. 40 | */ 41 | + (void)convertTension:(CGFloat)tension friction:(CGFloat)friction toBounciness:(CGFloat *)outBounciness speed:(CGFloat *)outSpeed; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimationExtras.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPAnimationExtras.h" 11 | #import "POPAnimationPrivate.h" 12 | 13 | #if TARGET_OS_IPHONE 14 | #import 15 | #endif 16 | 17 | #if TARGET_IPHONE_SIMULATOR 18 | UIKIT_EXTERN float UIAnimationDragCoefficient(); // UIKit private drag coeffient, use judiciously 19 | #endif 20 | 21 | #import "POPMath.h" 22 | 23 | CGFloat POPAnimationDragCoefficient() 24 | { 25 | #if TARGET_IPHONE_SIMULATOR 26 | return UIAnimationDragCoefficient(); 27 | #else 28 | return 1.0; 29 | #endif 30 | } 31 | 32 | @implementation CAAnimation (POPAnimationExtras) 33 | 34 | - (void)pop_applyDragCoefficient 35 | { 36 | CGFloat k = POPAnimationDragCoefficient(); 37 | if (k != 0 && k != 1) 38 | self.speed = 1 / k; 39 | } 40 | 41 | @end 42 | 43 | @implementation POPSpringAnimation (POPAnimationExtras) 44 | 45 | static const CGFloat POPBouncy3NormalizationRange = 20.0; 46 | static const CGFloat POPBouncy3NormalizationScale = 1.7; 47 | static const CGFloat POPBouncy3BouncinessNormalizedMin = 0.0; 48 | static const CGFloat POPBouncy3BouncinessNormalizedMax = 0.8; 49 | static const CGFloat POPBouncy3SpeedNormalizedMin = 0.5; 50 | static const CGFloat POPBouncy3SpeedNormalizedMax = 200; 51 | static const CGFloat POPBouncy3FrictionInterpolationMax = 0.01; 52 | 53 | + (void)convertBounciness:(CGFloat)bounciness speed:(CGFloat)speed toTension:(CGFloat *)outTension friction:(CGFloat *)outFriction mass:(CGFloat *)outMass 54 | { 55 | double b = POPNormalize(bounciness / POPBouncy3NormalizationScale, 0, POPBouncy3NormalizationRange); 56 | b = POPProjectNormal(b, POPBouncy3BouncinessNormalizedMin, POPBouncy3BouncinessNormalizedMax); 57 | 58 | double s = POPNormalize(speed / POPBouncy3NormalizationScale, 0, POPBouncy3NormalizationRange); 59 | 60 | CGFloat tension = POPProjectNormal(s, POPBouncy3SpeedNormalizedMin, POPBouncy3SpeedNormalizedMax); 61 | CGFloat friction = POPQuadraticOutInterpolation(b, POPBouncy3NoBounce(tension), POPBouncy3FrictionInterpolationMax); 62 | 63 | tension = POP_ANIMATION_TENSION_FOR_QC_TENSION(tension); 64 | friction = POP_ANIMATION_FRICTION_FOR_QC_FRICTION(friction); 65 | 66 | if (outTension) { 67 | *outTension = tension; 68 | } 69 | 70 | if (outFriction) { 71 | *outFriction = friction; 72 | } 73 | 74 | if (outMass) { 75 | *outMass = 1.0; 76 | } 77 | } 78 | 79 | + (void)convertTension:(CGFloat)tension friction:(CGFloat)friction toBounciness:(CGFloat *)outBounciness speed:(CGFloat *)outSpeed 80 | { 81 | // Convert to QC values, in which our calculations are done. 82 | CGFloat qcFriction = QC_FRICTION_FOR_POP_ANIMATION_FRICTION(friction); 83 | CGFloat qcTension = QC_TENSION_FOR_POP_ANIMATION_TENSION(tension); 84 | 85 | // Friction is a function of bounciness and tension, according to the following: 86 | // friction = POPQuadraticOutInterpolation(b, POPBouncy3NoBounce(tension), POPBouncy3FrictionInterpolationMax); 87 | // Solve for bounciness, given a tension and friction. 88 | 89 | CGFloat nobounceTension = POPBouncy3NoBounce(qcTension); 90 | CGFloat bounciness1, bounciness2; 91 | 92 | POPQuadraticSolve((nobounceTension - POPBouncy3FrictionInterpolationMax), // a 93 | 2 * (POPBouncy3FrictionInterpolationMax - nobounceTension), // b 94 | (nobounceTension - qcFriction), // c 95 | bounciness1, // x1 96 | bounciness2); // x2 97 | 98 | 99 | // Choose the quadratic solution within the normalized bounciness range 100 | CGFloat projectedNormalizedBounciness = (bounciness2 < POPBouncy3BouncinessNormalizedMax) ? bounciness2 : bounciness1; 101 | CGFloat projectedNormalizedSpeed = qcTension; 102 | 103 | // Reverse projection + normalization 104 | CGFloat bounciness = ((POPBouncy3NormalizationRange * POPBouncy3NormalizationScale) / (POPBouncy3BouncinessNormalizedMax - POPBouncy3BouncinessNormalizedMin)) * (projectedNormalizedBounciness - POPBouncy3BouncinessNormalizedMin); 105 | CGFloat speed = ((POPBouncy3NormalizationRange * POPBouncy3NormalizationScale) / (POPBouncy3SpeedNormalizedMax - POPBouncy3SpeedNormalizedMin)) * (projectedNormalizedSpeed - POPBouncy3SpeedNormalizedMin); 106 | 107 | // Write back results 108 | if (outBounciness) { 109 | *outBounciness = bounciness; 110 | } 111 | 112 | if (outSpeed) { 113 | *outSpeed = speed; 114 | } 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimationPrivate.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #define POP_ANIMATION_FRICTION_FOR_QC_FRICTION(qcFriction) (25.0 + (((qcFriction - 8.0) / 2.0) * (25.0 - 19.0))) 13 | #define POP_ANIMATION_TENSION_FOR_QC_TENSION(qcTension) (194.0 + (((qcTension - 30.0) / 50.0) * (375.0 - 194.0))) 14 | 15 | #define QC_FRICTION_FOR_POP_ANIMATION_FRICTION(fbFriction) (8.0 + 2.0 * ((fbFriction - 25.0)/(25.0 - 19.0))) 16 | #define QC_TENSION_FOR_POP_ANIMATION_TENSION(fbTension) (30.0 + 50.0 * ((fbTension - 194.0)/(375.0 - 194.0))) 17 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimationRuntime.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | #import "POPVector.h" 15 | 16 | enum POPValueType 17 | { 18 | kPOPValueUnknown = 0, 19 | kPOPValueInteger, 20 | kPOPValueFloat, 21 | kPOPValuePoint, 22 | kPOPValueSize, 23 | kPOPValueRect, 24 | kPOPValueEdgeInsets, 25 | kPOPValueAffineTransform, 26 | kPOPValueTransform, 27 | kPOPValueRange, 28 | kPOPValueColor, 29 | kPOPValueSCNVector3, 30 | kPOPValueSCNVector4, 31 | }; 32 | 33 | using namespace POP; 34 | 35 | /** 36 | Returns value type based on objc type description, given list of supported value types and length. 37 | */ 38 | extern POPValueType POPSelectValueType(const char *objctype, const POPValueType *types, size_t length); 39 | 40 | /** 41 | Returns value type based on objc object, given a list of supported value types and length. 42 | */ 43 | extern POPValueType POPSelectValueType(id obj, const POPValueType *types, size_t length); 44 | 45 | /** 46 | Array of all value types. 47 | */ 48 | extern const POPValueType kPOPAnimatableAllTypes[12]; 49 | 50 | /** 51 | Array of all value types supported for animation. 52 | */ 53 | extern const POPValueType kPOPAnimatableSupportTypes[10]; 54 | 55 | /** 56 | Returns a string description of a value type. 57 | */ 58 | extern NSString *POPValueTypeToString(POPValueType t); 59 | 60 | /** 61 | Returns a mutable dictionary of weak pointer keys to weak pointer values. 62 | */ 63 | extern CFMutableDictionaryRef POPDictionaryCreateMutableWeakPointerToWeakPointer(NSUInteger capacity) CF_RETURNS_RETAINED; 64 | 65 | /** 66 | Returns a mutable dictionary of weak pointer keys to weak pointer values. 67 | */ 68 | extern CFMutableDictionaryRef POPDictionaryCreateMutableWeakPointerToStrongObject(NSUInteger capacity) CF_RETURNS_RETAINED; 69 | 70 | /** 71 | Box a vector. 72 | */ 73 | extern id POPBox(VectorConstRef vec, POPValueType type, bool force = false); 74 | 75 | /** 76 | Unbox a vector. 77 | */ 78 | extern VectorRef POPUnbox(id value, POPValueType &type, NSUInteger &count, bool validate); 79 | 80 | /** 81 | Read/write block typedefs for convenience. 82 | */ 83 | typedef void(^pop_animatable_read_block)(id obj, CGFloat *value); 84 | typedef void(^pop_animatable_write_block)(id obj, const CGFloat *value); 85 | 86 | /** 87 | Read object value and return a Vector4r. 88 | */ 89 | NS_INLINE Vector4r read_values(pop_animatable_read_block read, id obj, size_t count) 90 | { 91 | Vector4r vec = Vector4r::Zero(); 92 | if (0 == count) 93 | return vec; 94 | 95 | read(obj, vec.data()); 96 | 97 | return vec; 98 | } 99 | 100 | NS_INLINE NSString *POPStringFromBOOL(BOOL value) 101 | { 102 | return value ? @"YES" : @"NO"; 103 | } 104 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimationTracer.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | @class POPAnimation; 15 | 16 | /** 17 | @abstract Tracer of animation events to fasciliate unit testing & debugging. 18 | */ 19 | @interface POPAnimationTracer : NSObject 20 | 21 | /** 22 | @abstract Start recording events. 23 | */ 24 | - (void)start; 25 | 26 | /** 27 | @abstract Stop recording events. 28 | */ 29 | - (void)stop; 30 | 31 | /** 32 | @abstract Resets any recoded events. Continues recording events if already started. 33 | */ 34 | - (void)reset; 35 | 36 | /** 37 | @abstract Property representing all recorded events. 38 | @discussion Events are returned in order of occurence. 39 | */ 40 | @property (nonatomic, assign, readonly) NSArray *allEvents; 41 | 42 | /** 43 | @abstract Property representing all recorded write events for convenience. 44 | @discussion Events are returned in order of occurence. 45 | */ 46 | @property (nonatomic, assign, readonly) NSArray *writeEvents; 47 | 48 | /** 49 | @abstract Queries for events of specified type. 50 | @param type The type of event to return. 51 | @returns An array of events of specified type in order of occurence. 52 | */ 53 | - (NSArray *)eventsWithType:(POPAnimationEventType)type; 54 | 55 | /** 56 | @abstract Property indicating whether tracer should automatically log events and reset collection on animation completion. 57 | */ 58 | @property (nonatomic, assign) BOOL shouldLogAndResetOnCompletion; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimationTracerInternal.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | @interface POPAnimationTracer (Internal) 15 | 16 | /** 17 | @abstract Designated initalizer. Pass the animation being traced. 18 | */ 19 | - (instancetype)initWithAnimation:(POPAnimation *)anAnim; 20 | 21 | /** 22 | @abstract Records read value. 23 | */ 24 | - (void)readPropertyValue:(id)aValue; 25 | 26 | /** 27 | @abstract Records write value. 28 | */ 29 | - (void)writePropertyValue:(id)aValue; 30 | 31 | /** 32 | Records to value update. 33 | */ 34 | - (void)updateToValue:(id)aValue; 35 | 36 | /** 37 | @abstract Records from value update. 38 | */ 39 | - (void)updateFromValue:(id)aValue; 40 | 41 | /** 42 | @abstract Records from value update. 43 | */ 44 | - (void)updateVelocity:(id)aValue; 45 | 46 | /** 47 | @abstract Records bounciness update. 48 | */ 49 | - (void)updateBounciness:(float)aFloat; 50 | 51 | /** 52 | @abstract Records speed update. 53 | */ 54 | - (void)updateSpeed:(float)aFloat; 55 | 56 | /** 57 | @abstract Records friction update. 58 | */ 59 | - (void)updateFriction:(float)aFloat; 60 | 61 | /** 62 | @abstract Records mass update. 63 | */ 64 | - (void)updateMass:(float)aFloat; 65 | 66 | /** 67 | @abstract Records tension update. 68 | */ 69 | - (void)updateTension:(float)aFloat; 70 | 71 | /** 72 | @abstract Records did add. 73 | */ 74 | - (void)didAdd; 75 | 76 | /** 77 | @abstract Records did start. 78 | */ 79 | - (void)didStart; 80 | 81 | /** 82 | @abstract Records did stop. 83 | */ 84 | - (void)didStop:(BOOL)finished; 85 | 86 | /** 87 | @abstract Records did reach to value. 88 | */ 89 | - (void)didReachToValue:(id)aValue; 90 | 91 | /** 92 | @abstract Records when an autoreverse animation takes place. 93 | */ 94 | - (void)autoreversed; 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimator.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @protocol POPAnimatorDelegate; 13 | 14 | /** 15 | @abstract The animator class renders animations. 16 | */ 17 | @interface POPAnimator : NSObject 18 | 19 | /** 20 | @abstract The shared animator instance. 21 | @discussion Consumers should generally use the shared instance in lieu of creating new instances. 22 | */ 23 | + (instancetype)sharedAnimator; 24 | 25 | /** 26 | @abstract The optional animator delegate. 27 | */ 28 | @property (weak, nonatomic) id delegate; 29 | 30 | @end 31 | 32 | /** 33 | @abstract The animator delegate. 34 | */ 35 | @protocol POPAnimatorDelegate 36 | 37 | /** 38 | @abstract Called on each frame before animation application. 39 | */ 40 | - (void)animatorWillAnimate:(POPAnimator *)animator; 41 | 42 | /** 43 | @abstract Called on each frame after animation application. 44 | */ 45 | - (void)animatorDidAnimate:(POPAnimator *)animator; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPAnimatorPrivate.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @class POPAnimation; 13 | 14 | @protocol POPAnimatorObserving 15 | @required 16 | 17 | /** 18 | @abstract Called on each observer after animator has advanced. Core Animation actions are disabled by default. 19 | */ 20 | - (void)animatorDidAnimate:(POPAnimator *)animator; 21 | 22 | @end 23 | 24 | @interface POPAnimator () 25 | 26 | #if !TARGET_OS_IPHONE 27 | /** 28 | Determines whether or not to use a high priority background thread for animation updates. Using a background thread can result in faster, more responsive updates, but may be less compatible. Defaults to YES. 29 | */ 30 | + (BOOL)disableBackgroundThread; 31 | + (void)setDisableBackgroundThread:(BOOL)flag; 32 | #endif 33 | 34 | /** 35 | Used for externally driven animator instances. 36 | */ 37 | @property (assign, nonatomic) BOOL disableDisplayLink; 38 | 39 | /** 40 | Time used when starting animations. Defaults to 0 meaning current media time is used. Exposed for unit testing. 41 | */ 42 | @property (assign, nonatomic) CFTimeInterval beginTime; 43 | 44 | /** 45 | Exposed for unit testing. 46 | */ 47 | - (void)renderTime:(CFTimeInterval)time; 48 | 49 | /** 50 | Funnel methods for category additions. 51 | */ 52 | - (void)addAnimation:(POPAnimation *)anim forObject:(id)obj key:(NSString *)key; 53 | - (void)removeAllAnimationsForObject:(id)obj; 54 | - (void)removeAnimationForObject:(id)obj key:(NSString *)key; 55 | - (NSArray *)animationKeysForObject:(id)obj; 56 | - (POPAnimation *)animationForObject:(id)obj key:(NSString *)key; 57 | 58 | /** 59 | @abstract Add an animator observer. Observer will be notified of each subsequent animator advance until removal. 60 | */ 61 | - (void)addObserver:(id)observer; 62 | 63 | /** 64 | @abstract Remove an animator observer. 65 | */ 66 | - (void)removeObserver:(id)observer; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPBasicAnimation.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | /** 13 | @abstract A concrete basic animation class. 14 | @discussion Animation is achieved through interpolation. 15 | */ 16 | @interface POPBasicAnimation : POPPropertyAnimation 17 | 18 | /** 19 | @abstract The designated initializer. 20 | @returns An instance of a basic animation. 21 | */ 22 | + (instancetype)animation; 23 | 24 | /** 25 | @abstract Convenience initializer that returns an animation with animatable property of name. 26 | @param name The name of the animatable property. 27 | @returns An instance of a basic animation configured with specified animatable property. 28 | */ 29 | + (instancetype)animationWithPropertyNamed:(NSString *)name; 30 | 31 | /** 32 | @abstract Convenience constructor. 33 | @returns Returns a basic animation with kCAMediaTimingFunctionDefault timing function. 34 | */ 35 | + (instancetype)defaultAnimation; 36 | 37 | /** 38 | @abstract Convenience constructor. 39 | @returns Returns a basic animation with kCAMediaTimingFunctionLinear timing function. 40 | */ 41 | + (instancetype)linearAnimation; 42 | 43 | /** 44 | @abstract Convenience constructor. 45 | @returns Returns a basic animation with kCAMediaTimingFunctionEaseIn timing function. 46 | */ 47 | + (instancetype)easeInAnimation; 48 | 49 | /** 50 | @abstract Convenience constructor. 51 | @returns Returns a basic animation with kCAMediaTimingFunctionEaseOut timing function. 52 | */ 53 | + (instancetype)easeOutAnimation; 54 | 55 | /** 56 | @abstract Convenience constructor. 57 | @returns Returns a basic animation with kCAMediaTimingFunctionEaseInEaseOut timing function. 58 | */ 59 | + (instancetype)easeInEaseOutAnimation; 60 | 61 | /** 62 | @abstract The duration in seconds. Defaults to 0.4. 63 | */ 64 | @property (assign, nonatomic) CFTimeInterval duration; 65 | 66 | /** 67 | @abstract A timing function defining the pacing of the animation. Defaults to nil indicating pacing according to kCAMediaTimingFunctionDefault. 68 | */ 69 | @property (strong, nonatomic) CAMediaTimingFunction *timingFunction; 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPBasicAnimation.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPBasicAnimationInternal.h" 11 | 12 | @implementation POPBasicAnimation 13 | 14 | #undef __state 15 | #define __state ((POPBasicAnimationState *)_state) 16 | 17 | #pragma mark - Lifecycle 18 | 19 | + (instancetype)animation 20 | { 21 | return [[self alloc] init]; 22 | } 23 | 24 | + (instancetype)animationWithPropertyNamed:(NSString *)aName 25 | { 26 | POPBasicAnimation *anim = [self animation]; 27 | anim.property = [POPAnimatableProperty propertyWithName:aName]; 28 | return anim; 29 | } 30 | 31 | - (void)_initState 32 | { 33 | _state = new POPBasicAnimationState(self); 34 | } 35 | 36 | + (instancetype)linearAnimation 37 | { 38 | POPBasicAnimation *anim = [self animation]; 39 | anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 40 | return anim; 41 | } 42 | 43 | + (instancetype)easeInAnimation 44 | { 45 | POPBasicAnimation *anim = [self animation]; 46 | anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; 47 | return anim; 48 | } 49 | 50 | + (instancetype)easeOutAnimation 51 | { 52 | POPBasicAnimation *anim = [self animation]; 53 | anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 54 | return anim; 55 | } 56 | 57 | + (instancetype)easeInEaseOutAnimation 58 | { 59 | POPBasicAnimation *anim = [self animation]; 60 | anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 61 | return anim; 62 | } 63 | 64 | + (instancetype)defaultAnimation 65 | { 66 | POPBasicAnimation *anim = [self animation]; 67 | anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]; 68 | return anim; 69 | } 70 | 71 | - (id)init 72 | { 73 | return [self _init]; 74 | } 75 | 76 | #pragma mark - Properties 77 | 78 | DEFINE_RW_PROPERTY(POPBasicAnimationState, duration, setDuration:, CFTimeInterval); 79 | DEFINE_RW_PROPERTY_OBJ(POPBasicAnimationState, timingFunction, setTimingFunction:, CAMediaTimingFunction*, __state->updatedTimingFunction();); 80 | 81 | #pragma mark - Utility 82 | 83 | - (void)_appendDescription:(NSMutableString *)s debug:(BOOL)debug 84 | { 85 | [super _appendDescription:s debug:debug]; 86 | if (__state->duration) 87 | [s appendFormat:@"; duration = %f", __state->duration]; 88 | } 89 | 90 | @end 91 | 92 | @implementation POPBasicAnimation (NSCopying) 93 | 94 | - (instancetype)copyWithZone:(NSZone *)zone { 95 | 96 | POPBasicAnimation *copy = [super copyWithZone:zone]; 97 | 98 | if (copy) { 99 | copy.duration = self.duration; 100 | copy.timingFunction = self.timingFunction; // not a 'copy', but timing functions are publicly immutable. 101 | } 102 | 103 | return copy; 104 | } 105 | 106 | @end -------------------------------------------------------------------------------- /Pods/pop/pop/POPBasicAnimationInternal.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPBasicAnimation.h" 11 | 12 | #import "POPPropertyAnimationInternal.h" 13 | 14 | // default animation duration 15 | static CGFloat const kPOPAnimationDurationDefault = 0.4; 16 | 17 | // progress threshold for computing done 18 | static CGFloat const kPOPProgressThreshold = 1e-6; 19 | 20 | static void interpolate(POPValueType valueType, NSUInteger count, const CGFloat *fromVec, const CGFloat *toVec, CGFloat *outVec, CGFloat p) 21 | { 22 | switch (valueType) { 23 | case kPOPValueInteger: 24 | case kPOPValueFloat: 25 | case kPOPValuePoint: 26 | case kPOPValueSize: 27 | case kPOPValueRect: 28 | case kPOPValueEdgeInsets: 29 | case kPOPValueColor: 30 | POPInterpolateVector(count, outVec, fromVec, toVec, p); 31 | break; 32 | default: 33 | NSCAssert(false, @"unhandled type %d", valueType); 34 | break; 35 | } 36 | } 37 | 38 | struct _POPBasicAnimationState : _POPPropertyAnimationState 39 | { 40 | CAMediaTimingFunction *timingFunction; 41 | double timingControlPoints[4]; 42 | CFTimeInterval duration; 43 | CFTimeInterval timeProgress; 44 | 45 | _POPBasicAnimationState(id __unsafe_unretained anim) : _POPPropertyAnimationState(anim), 46 | timingFunction(nil), 47 | timingControlPoints{0.}, 48 | duration(kPOPAnimationDurationDefault), 49 | timeProgress(0.) 50 | { 51 | type = kPOPAnimationBasic; 52 | } 53 | 54 | bool isDone() { 55 | if (_POPPropertyAnimationState::isDone()) { 56 | return true; 57 | } 58 | return timeProgress + kPOPProgressThreshold >= 1.; 59 | } 60 | 61 | void updatedTimingFunction() 62 | { 63 | float vec[4] = {0.}; 64 | [timingFunction getControlPointAtIndex:1 values:&vec[0]]; 65 | [timingFunction getControlPointAtIndex:2 values:&vec[2]]; 66 | for (NSUInteger idx = 0; idx < POP_ARRAY_COUNT(vec); idx++) { 67 | timingControlPoints[idx] = vec[idx]; 68 | } 69 | } 70 | 71 | bool advance(CFTimeInterval time, CFTimeInterval dt, id obj) { 72 | // default timing function 73 | if (!timingFunction) { 74 | ((POPBasicAnimation *)self).timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]; 75 | } 76 | 77 | // solve for normalized time, aka progresss [0, 1] 78 | CGFloat p = 1.0f; 79 | if (duration > 0.0f) { 80 | // cap local time to duration 81 | CFTimeInterval t = MIN(time - startTime, duration) / duration; 82 | p = POPTimingFunctionSolve(timingControlPoints, t, SOLVE_EPS(duration)); 83 | timeProgress = t; 84 | } else { 85 | timeProgress = 1.; 86 | } 87 | 88 | // interpolate and advance 89 | interpolate(valueType, valueCount, fromVec->data(), toVec->data(), currentVec->data(), p); 90 | progress = p; 91 | clampCurrentValue(); 92 | 93 | return true; 94 | } 95 | }; 96 | 97 | typedef struct _POPBasicAnimationState POPBasicAnimationState; 98 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPCGUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #if TARGET_OS_IPHONE 13 | #import 14 | #else 15 | #import 16 | #endif 17 | 18 | #import "POPDefines.h" 19 | 20 | #if SCENEKIT_SDK_AVAILABLE 21 | #import 22 | #endif 23 | 24 | POP_EXTERN_C_BEGIN 25 | 26 | NS_INLINE CGPoint values_to_point(const CGFloat values[]) 27 | { 28 | return CGPointMake(values[0], values[1]); 29 | } 30 | 31 | NS_INLINE CGSize values_to_size(const CGFloat values[]) 32 | { 33 | return CGSizeMake(values[0], values[1]); 34 | } 35 | 36 | NS_INLINE CGRect values_to_rect(const CGFloat values[]) 37 | { 38 | return CGRectMake(values[0], values[1], values[2], values[3]); 39 | } 40 | 41 | #if SCENEKIT_SDK_AVAILABLE 42 | NS_INLINE SCNVector3 values_to_vec3(const CGFloat values[]) 43 | { 44 | return SCNVector3Make(values[0], values[1], values[2]); 45 | } 46 | 47 | NS_INLINE SCNVector4 values_to_vec4(const CGFloat values[]) 48 | { 49 | return SCNVector4Make(values[0], values[1], values[2], values[3]); 50 | } 51 | #endif 52 | 53 | #if TARGET_OS_IPHONE 54 | 55 | NS_INLINE UIEdgeInsets values_to_edge_insets(const CGFloat values[]) 56 | { 57 | return UIEdgeInsetsMake(values[0], values[1], values[2], values[3]); 58 | } 59 | 60 | #endif 61 | 62 | NS_INLINE void values_from_point(CGFloat values[], CGPoint p) 63 | { 64 | values[0] = p.x; 65 | values[1] = p.y; 66 | } 67 | 68 | NS_INLINE void values_from_size(CGFloat values[], CGSize s) 69 | { 70 | values[0] = s.width; 71 | values[1] = s.height; 72 | } 73 | 74 | NS_INLINE void values_from_rect(CGFloat values[], CGRect r) 75 | { 76 | values[0] = r.origin.x; 77 | values[1] = r.origin.y; 78 | values[2] = r.size.width; 79 | values[3] = r.size.height; 80 | } 81 | 82 | #if SCENEKIT_SDK_AVAILABLE 83 | NS_INLINE void values_from_vec3(CGFloat values[], SCNVector3 v) 84 | { 85 | values[0] = v.x; 86 | values[1] = v.y; 87 | values[2] = v.z; 88 | } 89 | 90 | NS_INLINE void values_from_vec4(CGFloat values[], SCNVector4 v) 91 | { 92 | values[0] = v.x; 93 | values[1] = v.y; 94 | values[2] = v.z; 95 | values[3] = v.w; 96 | } 97 | #endif 98 | 99 | #if TARGET_OS_IPHONE 100 | 101 | NS_INLINE void values_from_edge_insets(CGFloat values[], UIEdgeInsets i) 102 | { 103 | values[0] = i.top; 104 | values[1] = i.left; 105 | values[2] = i.bottom; 106 | values[3] = i.right; 107 | } 108 | 109 | #endif 110 | 111 | /** 112 | Takes a CGColorRef and converts it into RGBA components, if necessary. 113 | */ 114 | extern void POPCGColorGetRGBAComponents(CGColorRef color, CGFloat components[]); 115 | 116 | /** 117 | Takes RGBA components and returns a CGColorRef. 118 | */ 119 | extern CGColorRef POPCGColorRGBACreate(const CGFloat components[]) CF_RETURNS_RETAINED; 120 | 121 | /** 122 | Takes a color reference and returns a CGColor. 123 | */ 124 | extern CGColorRef POPCGColorWithColor(id color) CF_RETURNS_NOT_RETAINED; 125 | 126 | #if TARGET_OS_IPHONE 127 | 128 | /** 129 | Takes a UIColor and converts it into RGBA components, if necessary. 130 | */ 131 | extern void POPUIColorGetRGBAComponents(UIColor *color, CGFloat components[]); 132 | 133 | /** 134 | Takes RGBA components and returns a UIColor. 135 | */ 136 | extern UIColor *POPUIColorRGBACreate(const CGFloat components[]) NS_RETURNS_RETAINED; 137 | 138 | #else 139 | 140 | /** 141 | Takes a NSColor and converts it into RGBA components, if necessary. 142 | */ 143 | extern void POPNSColorGetRGBAComponents(NSColor *color, CGFloat components[]); 144 | 145 | /** 146 | Takes RGBA components and returns a NSColor. 147 | */ 148 | extern NSColor *POPNSColorRGBACreate(const CGFloat components[]) NS_RETURNS_RETAINED; 149 | 150 | #endif 151 | 152 | POP_EXTERN_C_END 153 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPCGUtils.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPCGUtils.h" 11 | 12 | #import 13 | 14 | void POPCGColorGetRGBAComponents(CGColorRef color, CGFloat components[]) 15 | { 16 | if (color) { 17 | const CGFloat *colors = CGColorGetComponents(color); 18 | size_t count = CGColorGetNumberOfComponents(color); 19 | 20 | if (4 == count) { 21 | // RGB colorspace 22 | components[0] = colors[0]; 23 | components[1] = colors[1]; 24 | components[2] = colors[2]; 25 | components[3] = colors[3]; 26 | } else if (2 == count) { 27 | // Grey colorspace 28 | components[0] = components[1] = components[2] = colors[0]; 29 | components[3] = colors[1]; 30 | } else { 31 | // Use CI to convert 32 | CIColor *ciColor = [CIColor colorWithCGColor:color]; 33 | components[0] = ciColor.red; 34 | components[1] = ciColor.green; 35 | components[2] = ciColor.blue; 36 | components[3] = ciColor.alpha; 37 | } 38 | } else { 39 | memset(components, 0, 4 * sizeof(components[0])); 40 | } 41 | } 42 | 43 | CGColorRef POPCGColorRGBACreate(const CGFloat components[]) 44 | { 45 | #if TARGET_OS_IPHONE 46 | CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); 47 | CGColorRef color = CGColorCreate(space, components); 48 | CGColorSpaceRelease(space); 49 | return color; 50 | #else 51 | return CGColorCreateGenericRGB(components[0], components[1], components[2], components[3]); 52 | #endif 53 | } 54 | 55 | CGColorRef POPCGColorWithColor(id color) 56 | { 57 | if (CFGetTypeID((__bridge CFTypeRef)color) == CGColorGetTypeID()) { 58 | return ((__bridge CGColorRef)color); 59 | } 60 | #if TARGET_OS_IPHONE 61 | else if ([color isKindOfClass:[UIColor class]]) { 62 | return [color CGColor]; 63 | } 64 | #else 65 | else if ([color isKindOfClass:[NSColor class]]) { 66 | // -[NSColor CGColor] is only supported since OSX 10.8+ 67 | if ([color respondsToSelector:@selector(CGColor)]) { 68 | return [color CGColor]; 69 | } 70 | 71 | /* 72 | * Otherwise create a CGColorRef manually. 73 | * 74 | * The original accessor is (or would be) declared as: 75 | * @property(readonly) CGColorRef CGColor; 76 | * - (CGColorRef)CGColor NS_RETURNS_INNER_POINTER CF_RETURNS_NOT_RETAINED; 77 | * 78 | * (Please note that OSX' accessor is atomic, while iOS' isn't.) 79 | * 80 | * The access to the NSColor object must thus be synchronized 81 | * and the CGColorRef be stored as an associated object, 82 | * to return a reference which doesn't need to be released manually. 83 | */ 84 | @synchronized(color) { 85 | static const void* key = &key; 86 | 87 | CGColorRef colorRef = (__bridge CGColorRef)objc_getAssociatedObject(color, key); 88 | 89 | if (!colorRef) { 90 | size_t numberOfComponents = [color numberOfComponents]; 91 | CGFloat components[numberOfComponents]; 92 | CGColorSpaceRef colorSpace = [[color colorSpace] CGColorSpace]; 93 | 94 | [color getComponents:components]; 95 | 96 | colorRef = CGColorCreate(colorSpace, components); 97 | 98 | objc_setAssociatedObject(color, key, (__bridge id)colorRef, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 99 | CGColorRelease(colorRef); 100 | } 101 | 102 | return colorRef; 103 | } 104 | } 105 | #endif 106 | return nil; 107 | } 108 | 109 | #if TARGET_OS_IPHONE 110 | 111 | void POPUIColorGetRGBAComponents(UIColor *color, CGFloat components[]) 112 | { 113 | return POPCGColorGetRGBAComponents(POPCGColorWithColor(color), components); 114 | } 115 | 116 | UIColor *POPUIColorRGBACreate(const CGFloat components[]) 117 | { 118 | CGColorRef colorRef = POPCGColorRGBACreate(components); 119 | UIColor *color = [[UIColor alloc] initWithCGColor:colorRef]; 120 | CGColorRelease(colorRef); 121 | return color; 122 | } 123 | 124 | #else 125 | 126 | void POPNSColorGetRGBAComponents(NSColor *color, CGFloat components[]) 127 | { 128 | return POPCGColorGetRGBAComponents(POPCGColorWithColor(color), components); 129 | } 130 | 131 | NSColor *POPNSColorRGBACreate(const CGFloat components[]) 132 | { 133 | CGColorRef colorRef = POPCGColorRGBACreate(components); 134 | NSColor *color = nil; 135 | 136 | if (colorRef) { 137 | if ([NSColor respondsToSelector:@selector(colorWithCGColor:)]) { 138 | color = [NSColor colorWithCGColor:colorRef]; 139 | } else { 140 | color = [NSColor colorWithCIColor:[CIColor colorWithCGColor:colorRef]]; 141 | } 142 | 143 | CGColorRelease(colorRef); 144 | } 145 | 146 | return color; 147 | } 148 | 149 | #endif 150 | 151 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPCustomAnimation.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @class POPCustomAnimation; 13 | 14 | /** 15 | @abstract POPCustomAnimationBlock is the callback block of a custom animation. 16 | @discussion This block will be executed for each animation frame and should update the property or properties being animated based on current timing. 17 | @param target The object being animated. Reference the passed in target to help avoid retain loops. 18 | @param animation The custom animation instance. Use to determine the current and elapsed time since last callback. Reference the passed in animation to help avoid retain loops. 19 | @return Flag indicating whether the animation should continue animating. Return NO to indicate animation is done. 20 | */ 21 | typedef BOOL (^POPCustomAnimationBlock)(id target, POPCustomAnimation *animation); 22 | 23 | /** 24 | @abstract POPCustomAnimation is a concrete animation subclass for custom animations. 25 | */ 26 | @interface POPCustomAnimation : POPAnimation 27 | 28 | /** 29 | @abstract Creates and returns an initialized custom animation instance. 30 | @discussion This is the designated initializer. 31 | @param block The custom animation callback block. See {@ref POPCustomAnimationBlock}. 32 | @return The initialized custom animation instance. 33 | */ 34 | + (instancetype)animationWithBlock:(POPCustomAnimationBlock)block; 35 | 36 | /** 37 | @abstract The current animation time at time of callback. 38 | */ 39 | @property (readonly, nonatomic) CFTimeInterval currentTime; 40 | 41 | /** 42 | @abstract The elapsed animation time since last callback. 43 | */ 44 | @property (readonly, nonatomic) CFTimeInterval elapsedTime; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPCustomAnimation.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPAnimationInternal.h" 11 | 12 | #import "POPCustomAnimation.h" 13 | 14 | @interface POPCustomAnimation () 15 | @property (nonatomic, copy) POPCustomAnimationBlock animate; 16 | @end 17 | 18 | @implementation POPCustomAnimation 19 | @synthesize currentTime = _currentTime; 20 | @synthesize elapsedTime = _elapsedTime; 21 | @synthesize animate = _animate; 22 | 23 | + (instancetype)animationWithBlock:(BOOL(^)(id target, POPCustomAnimation *))block 24 | { 25 | POPCustomAnimation *b = [[self alloc] _init]; 26 | b.animate = block; 27 | return b; 28 | } 29 | 30 | - (id)_init 31 | { 32 | self = [super _init]; 33 | if (nil != self) { 34 | _state->type = kPOPAnimationCustom; 35 | } 36 | return self; 37 | } 38 | 39 | - (CFTimeInterval)beginTime 40 | { 41 | POPAnimationState *s = POPAnimationGetState(self); 42 | return s->startTime > 0 ? s->startTime : s->beginTime; 43 | } 44 | 45 | - (BOOL)_advance:(id)object currentTime:(CFTimeInterval)currentTime elapsedTime:(CFTimeInterval)elapsedTime 46 | { 47 | _currentTime = currentTime; 48 | _elapsedTime = elapsedTime; 49 | return _animate(object, self); 50 | } 51 | 52 | - (void)_appendDescription:(NSMutableString *)s debug:(BOOL)debug 53 | { 54 | [s appendFormat:@"; elapsedTime = %f; currentTime = %f;", _elapsedTime, _currentTime]; 55 | } 56 | 57 | @end 58 | 59 | /** 60 | * Note that only the animate block is copied, but not the current/elapsed times 61 | */ 62 | @implementation POPCustomAnimation (NSCopying) 63 | 64 | - (instancetype)copyWithZone:(NSZone *)zone { 65 | 66 | POPCustomAnimation *copy = [super copyWithZone:zone]; 67 | 68 | if (copy) { 69 | copy.animate = self.animate; 70 | } 71 | 72 | return copy; 73 | } 74 | 75 | @end -------------------------------------------------------------------------------- /Pods/pop/pop/POPDecayAnimation.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | /** 13 | @abstract A concrete decay animation class. 14 | @discussion Animation is achieved through gradual decay of animation value. 15 | */ 16 | @interface POPDecayAnimation : POPPropertyAnimation 17 | 18 | /** 19 | @abstract The designated initializer. 20 | @returns An instance of a decay animation. 21 | */ 22 | + (instancetype)animation; 23 | 24 | /** 25 | @abstract Convenience initializer that returns an animation with animatable property of name. 26 | @param name The name of the animatable property. 27 | @returns An instance of a decay animation configured with specified animatable property. 28 | */ 29 | + (instancetype)animationWithPropertyNamed:(NSString *)name; 30 | 31 | /** 32 | @abstract The current velocity value. 33 | @discussion Set before animation start to account for initial velocity. Expressed in change of value units per second. The only POPValueTypes supported for velocity are: kPOPValuePoint, kPOPValueInteger, kPOPValueFloat, kPOPValueRect, and kPOPValueSize. 34 | */ 35 | @property (copy, nonatomic) id velocity; 36 | 37 | /** 38 | @abstract The original velocity value. 39 | @discussion Since the velocity property is modified as the animation progresses, this property stores the original, passed in velocity to support autoreverse and repeatCount. 40 | */ 41 | @property (copy, nonatomic, readonly) id originalVelocity; 42 | 43 | /** 44 | @abstract The deceleration factor. 45 | @discussion Values specifies should be in the range [0, 1]. Lower values results in faster deceleration. Defaults to 0.998. 46 | */ 47 | @property (assign, nonatomic) CGFloat deceleration; 48 | 49 | /** 50 | @abstract The expected duration. 51 | @discussion Derived based on input velocity and deceleration values. 52 | */ 53 | @property (readonly, assign, nonatomic) CFTimeInterval duration; 54 | 55 | /** 56 | The to value is derived based on input velocity and deceleration. 57 | */ 58 | - (void)setToValue:(id)toValue NS_UNAVAILABLE; 59 | 60 | /** 61 | @abstract The reversed velocity. 62 | @discussion The reversed velocity based on the originalVelocity when the animation was set up. 63 | */ 64 | - (id)reversedVelocity; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPDecayAnimationInternal.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPDecayAnimation.h" 11 | 12 | #import 13 | 14 | #import "POPPropertyAnimationInternal.h" 15 | 16 | // minimal velocity factor before decay animation is considered complete, in units / s 17 | static CGFloat kPOPAnimationDecayMinimalVelocityFactor = 5.; 18 | 19 | // default decay animation deceleration 20 | static CGFloat kPOPAnimationDecayDecelerationDefault = 0.998; 21 | 22 | static void decay_position(CGFloat *x, CGFloat *v, NSUInteger count, CFTimeInterval dt, CGFloat deceleration) 23 | { 24 | dt *= 1000; 25 | 26 | // v0 = v / 1000 27 | // v = v0 * powf(deceleration, dt); 28 | // v = v * 1000; 29 | 30 | // x0 = x; 31 | // x = x0 + v0 * deceleration * (1 - powf(deceleration, dt)) / (1 - deceleration) 32 | float v0[count]; 33 | float kv = powf(deceleration, dt); 34 | float kx = deceleration * (1 - kv) / (1 - deceleration); 35 | 36 | for (NSUInteger idx = 0; idx < count; idx++) { 37 | v0[idx] = v[idx] / 1000.; 38 | v[idx] = v0[idx] * kv * 1000.; 39 | x[idx] = x[idx] + v0[idx] * kx; 40 | } 41 | } 42 | 43 | struct _POPDecayAnimationState : _POPPropertyAnimationState 44 | { 45 | double deceleration; 46 | CFTimeInterval duration; 47 | 48 | _POPDecayAnimationState(id __unsafe_unretained anim) : 49 | _POPPropertyAnimationState(anim), 50 | deceleration(kPOPAnimationDecayDecelerationDefault), 51 | duration(0) 52 | { 53 | type = kPOPAnimationDecay; 54 | } 55 | 56 | bool isDone() { 57 | if (_POPPropertyAnimationState::isDone()) { 58 | return true; 59 | } 60 | 61 | CGFloat f = dynamicsThreshold * kPOPAnimationDecayMinimalVelocityFactor; 62 | const CGFloat *velocityValues = vec_data(velocityVec); 63 | for (NSUInteger idx = 0; idx < valueCount; idx++) { 64 | if (std::abs((velocityValues[idx])) >= f) 65 | return false; 66 | } 67 | return true; 68 | 69 | } 70 | 71 | void computeDuration() { 72 | 73 | // compute duration till threshold velocity 74 | Vector4r scaledVelocity = vector4(velocityVec) / 1000.; 75 | 76 | double k = dynamicsThreshold * kPOPAnimationDecayMinimalVelocityFactor / 1000.; 77 | double vx = k / scaledVelocity.x; 78 | double vy = k / scaledVelocity.y; 79 | double vz = k / scaledVelocity.z; 80 | double vw = k / scaledVelocity.w; 81 | double d = log(deceleration) * 1000.; 82 | duration = MAX(MAX(MAX(log(fabs(vx)) / d, log(fabs(vy)) / d), log(fabs(vz)) / d), log(fabs(vw)) / d); 83 | 84 | // ensure velocity threshold is exceeded 85 | if (std::isnan(duration) || duration < 0) { 86 | duration = 0; 87 | } 88 | } 89 | 90 | void computeToValue() { 91 | // to value assuming final velocity as a factor of dynamics threshold 92 | // derived from v' = v * d^dt used in decay_position 93 | // to compute the to value with maximal dt, p' = p + (v * d) / (1 - d) 94 | VectorRef fromValue = NULL != currentVec ? currentVec : fromVec; 95 | if (!fromValue) { 96 | return; 97 | } 98 | 99 | // ensure duration is computed 100 | if (0 == duration) { 101 | computeDuration(); 102 | } 103 | 104 | // compute to value 105 | VectorRef toValue(Vector::new_vector(fromValue.get())); 106 | Vector4r velocity = velocityVec->vector4r(); 107 | decay_position(toValue->data(), velocity.data(), valueCount, duration, deceleration); 108 | toVec = toValue; 109 | } 110 | 111 | bool advance(CFTimeInterval time, CFTimeInterval dt, id obj) { 112 | // advance past not yet initialized animations 113 | if (NULL == currentVec) { 114 | return false; 115 | } 116 | 117 | decay_position(currentVec->data(), velocityVec->data(), valueCount, dt, deceleration); 118 | 119 | // clamp to compute end value; avoid possibility of decaying past 120 | clampCurrentValue(kPOPAnimationClampEnd | clampMode); 121 | 122 | return true; 123 | } 124 | 125 | }; 126 | 127 | typedef struct _POPDecayAnimationState POPDecayAnimationState; 128 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPDefines.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #ifndef POP_POPDefines_h 11 | #define POP_POPDefines_h 12 | 13 | #import 14 | 15 | #ifdef __cplusplus 16 | # define POP_EXTERN_C_BEGIN extern "C" { 17 | # define POP_EXTERN_C_END } 18 | #else 19 | # define POP_EXTERN_C_BEGIN 20 | # define POP_EXTERN_C_END 21 | #endif 22 | 23 | #define POP_ARRAY_COUNT(x) sizeof(x) / sizeof(x[0]) 24 | 25 | #if defined (__cplusplus) && defined (__GNUC__) 26 | # define POP_NOTHROW __attribute__ ((nothrow)) 27 | #else 28 | # define POP_NOTHROW 29 | #endif 30 | 31 | #if TARGET_OS_MAC 32 | #define SCENEKIT_SDK_AVAILABLE defined(POP_USE_SCENEKIT) 33 | #elif TARGET_OS_IPHONE 34 | #define SCENEKIT_SDK_AVAILABLE defined(POP_USE_SCENEKIT) 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPGeometry.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #if TARGET_OS_IPHONE 13 | #import 14 | #endif 15 | 16 | #if !TARGET_OS_IPHONE 17 | 18 | /** NSValue extensions to support animatable types. */ 19 | @interface NSValue (POP) 20 | 21 | /** 22 | @abstract Creates an NSValue given a CGPoint. 23 | */ 24 | + (NSValue *)valueWithCGPoint:(CGPoint)point; 25 | 26 | /** 27 | @abstract Creates an NSValue given a CGSize. 28 | */ 29 | + (NSValue *)valueWithCGSize:(CGSize)size; 30 | 31 | /** 32 | @abstract Creates an NSValue given a CGRect. 33 | */ 34 | + (NSValue *)valueWithCGRect:(CGRect)rect; 35 | 36 | /** 37 | @abstract Creates an NSValue given a CFRange. 38 | */ 39 | + (NSValue *)valueWithCFRange:(CFRange)range; 40 | 41 | /** 42 | @abstract Creates an NSValue given a CGAffineTransform. 43 | */ 44 | + (NSValue *)valueWithCGAffineTransform:(CGAffineTransform)transform; 45 | 46 | /** 47 | @abstract Returns the underlying CGPoint value. 48 | */ 49 | - (CGPoint)CGPointValue; 50 | 51 | /** 52 | @abstract Returns the underlying CGSize value. 53 | */ 54 | - (CGSize)CGSizeValue; 55 | 56 | /** 57 | @abstract Returns the underlying CGRect value. 58 | */ 59 | - (CGRect)CGRectValue; 60 | 61 | /** 62 | @abstract Returns the underlying CFRange value. 63 | */ 64 | - (CFRange)CFRangeValue; 65 | 66 | /** 67 | @abstract Returns the underlying CGAffineTransform value. 68 | */ 69 | - (CGAffineTransform)CGAffineTransformValue; 70 | 71 | @end 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPGeometry.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPGeometry.h" 11 | 12 | #if !TARGET_OS_IPHONE 13 | @implementation NSValue (POP) 14 | 15 | + (NSValue *)valueWithCGPoint:(CGPoint)point { 16 | return [NSValue valueWithBytes:&point objCType:@encode(CGPoint)]; 17 | } 18 | 19 | + (NSValue *)valueWithCGSize:(CGSize)size { 20 | return [NSValue valueWithBytes:&size objCType:@encode(CGSize)]; 21 | } 22 | 23 | + (NSValue *)valueWithCGRect:(CGRect)rect { 24 | return [NSValue valueWithBytes:&rect objCType:@encode(CGRect)]; 25 | } 26 | 27 | + (NSValue *)valueWithCFRange:(CFRange)range { 28 | return [NSValue valueWithBytes:&range objCType:@encode(CFRange)]; 29 | } 30 | 31 | + (NSValue *)valueWithCGAffineTransform:(CGAffineTransform)transform 32 | { 33 | return [NSValue valueWithBytes:&transform objCType:@encode(CGAffineTransform)]; 34 | } 35 | 36 | - (CGPoint)CGPointValue { 37 | CGPoint result; 38 | [self getValue:&result]; 39 | return result; 40 | } 41 | 42 | - (CGSize)CGSizeValue { 43 | CGSize result; 44 | [self getValue:&result]; 45 | return result; 46 | } 47 | 48 | - (CGRect)CGRectValue { 49 | CGRect result; 50 | [self getValue:&result]; 51 | return result; 52 | } 53 | 54 | - (CFRange)CFRangeValue { 55 | CFRange result; 56 | [self getValue:&result]; 57 | return result; 58 | } 59 | 60 | - (CGAffineTransform)CGAffineTransformValue { 61 | CGAffineTransform result; 62 | [self getValue:&result]; 63 | return result; 64 | } 65 | @end 66 | 67 | #endif 68 | 69 | #if TARGET_OS_IPHONE 70 | #import "POPDefines.h" 71 | 72 | #if SCENEKIT_SDK_AVAILABLE 73 | #import 74 | 75 | /** 76 | Dirty hacks because iOS is weird and decided to define both SCNVector3's and SCNVector4's objCType as "t". However @encode(SCNVector3) and @encode(SCNVector4) both return the proper definition ("{SCNVector3=fff}" and "{SCNVector4=ffff}" respectively) 77 | 78 | [[NSValue valueWithSCNVector3:SCNVector3Make(0.0, 0.0, 0.0)] objcType] returns "t", whereas it should return "{SCNVector3=fff}". 79 | 80 | *flips table* 81 | */ 82 | @implementation NSValue (SceneKitFixes) 83 | 84 | + (NSValue *)valueWithSCNVector3:(SCNVector3)vec3 { 85 | return [NSValue valueWithBytes:&vec3 objCType:@encode(SCNVector3)]; 86 | } 87 | 88 | + (NSValue *)valueWithSCNVector4:(SCNVector4)vec4 { 89 | return [NSValue valueWithBytes:&vec4 objCType:@encode(SCNVector4)]; 90 | } 91 | 92 | @end 93 | #endif 94 | #endif 95 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPMath.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | #import "POPDefines.h" 15 | #import "POPVector.h" 16 | 17 | NS_INLINE CGFloat sqrtr(CGFloat f) 18 | { 19 | #if CGFLOAT_IS_DOUBLE 20 | return sqrt(f); 21 | #else 22 | return sqrtf(f); 23 | #endif 24 | } 25 | 26 | // round to nearest sub; pass 2.0 to round to every 0.5 (eg: retina pixels) 27 | NS_INLINE CGFloat POPSubRound(CGFloat f, CGFloat sub) 28 | { 29 | return round(f * sub) / sub; 30 | } 31 | 32 | #define MIX(a, b, f) ((a) + (f) * ((b) - (a))) 33 | 34 | // the longer the duration, the higher the necessary precision 35 | #define SOLVE_EPS(dur) (1. / (1000. * (dur))) 36 | 37 | #define _EQLF_(x, y, epsilon) (fabsf ((x) - (y)) < epsilon) 38 | 39 | extern void POPInterpolateVector(NSUInteger count, CGFloat *dst, const CGFloat *from, const CGFloat *to, CGFloat f); 40 | 41 | extern double POPTimingFunctionSolve(const double vec[4], double t, double eps); 42 | 43 | // quadratic mapping of t [0, 1] to [start, end] 44 | extern double POPQuadraticOutInterpolation(double t, double start, double end); 45 | 46 | // normalize value to [0, 1] based on its range [startValue, endValue] 47 | extern double POPNormalize(double value, double startValue, double endValue); 48 | 49 | // project a normalized value [0, 1] to a given range [start, end] 50 | extern double POPProjectNormal(double n, double start, double end); 51 | 52 | // solve a quadratic equation of the form a * x^2 + b * x + c = 0 53 | extern void POPQuadraticSolve(CGFloat a, CGFloat b, CGFloat c, CGFloat &x1, CGFloat &x2); 54 | 55 | // for a given tension return the bouncy 3 friction that produces no bounce 56 | extern double POPBouncy3NoBounce(double tension); 57 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPMath.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPMath.h" 11 | 12 | #import "POPAnimationPrivate.h" 13 | #import "UnitBezier.h" 14 | 15 | void POPInterpolateVector(NSUInteger count, CGFloat *dst, const CGFloat *from, const CGFloat *to, CGFloat f) 16 | { 17 | for (NSUInteger idx = 0; idx < count; idx++) { 18 | dst[idx] = MIX(from[idx], to[idx], f); 19 | } 20 | } 21 | 22 | double POPTimingFunctionSolve(const double vec[4], double t, double eps) 23 | { 24 | WebCore::UnitBezier bezier(vec[0], vec[1], vec[2], vec[3]); 25 | return bezier.solve(t, eps); 26 | } 27 | 28 | double POPNormalize(double value, double startValue, double endValue) 29 | { 30 | return (value - startValue) / (endValue - startValue); 31 | } 32 | 33 | double POPProjectNormal(double n, double start, double end) 34 | { 35 | return start + (n * (end - start)); 36 | } 37 | 38 | static double linear_interpolation(double t, double start, double end) 39 | { 40 | return t * end + (1.f - t) * start; 41 | } 42 | 43 | double POPQuadraticOutInterpolation(double t, double start, double end) 44 | { 45 | return linear_interpolation(2*t - t*t, start, end); 46 | } 47 | 48 | static double b3_friction1(double x) 49 | { 50 | return (0.0007 * pow(x, 3)) - (0.031 * pow(x, 2)) + 0.64 * x + 1.28; 51 | } 52 | 53 | static double b3_friction2(double x) 54 | { 55 | return (0.000044 * pow(x, 3)) - (0.006 * pow(x, 2)) + 0.36 * x + 2.; 56 | } 57 | 58 | static double b3_friction3(double x) 59 | { 60 | return (0.00000045 * pow(x, 3)) - (0.000332 * pow(x, 2)) + 0.1078 * x + 5.84; 61 | } 62 | 63 | double POPBouncy3NoBounce(double tension) 64 | { 65 | double friction = 0; 66 | if (tension <= 18.) { 67 | friction = b3_friction1(tension); 68 | } else if (tension > 18 && tension <= 44) { 69 | friction = b3_friction2(tension); 70 | } else if (tension > 44) { 71 | friction = b3_friction3(tension); 72 | } else { 73 | assert(false); 74 | } 75 | return friction; 76 | } 77 | 78 | void POPQuadraticSolve(CGFloat a, CGFloat b, CGFloat c, CGFloat &x1, CGFloat &x2) 79 | { 80 | CGFloat discriminant = sqrt(b * b - 4 * a * c); 81 | x1 = (-b + discriminant) / (2 * a); 82 | x2 = (-b - discriminant) / (2 * a); 83 | } 84 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPPropertyAnimation.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | /** 14 | @abstract Flags for clamping animation values. 15 | @discussion Animation values can optionally be clamped to avoid overshoot. kPOPAnimationClampStart ensures values are more than fromValue and kPOPAnimationClampEnd ensures values are less than toValue. 16 | */ 17 | typedef NS_OPTIONS(NSUInteger, POPAnimationClampFlags) 18 | { 19 | kPOPAnimationClampNone = 0, 20 | kPOPAnimationClampStart = 1UL << 0, 21 | kPOPAnimationClampEnd = 1UL << 1, 22 | kPOPAnimationClampBoth = kPOPAnimationClampStart | kPOPAnimationClampEnd, 23 | }; 24 | 25 | /** 26 | @abstract The semi-concrete property animation subclass. 27 | */ 28 | @interface POPPropertyAnimation : POPAnimation 29 | 30 | /** 31 | @abstract The property to animate. 32 | */ 33 | @property (strong, nonatomic) POPAnimatableProperty *property; 34 | 35 | /** 36 | @abstract The value to animate from. 37 | @discussion The value type should match the property. If unspecified, the value is initialized to the object's current value on animation start. 38 | */ 39 | @property (copy, nonatomic) id fromValue; 40 | 41 | /** 42 | @abstract The value to animate to. 43 | @discussion The value type should match the property. If unspecified, the value is initialized to the object's current value on animation start. 44 | */ 45 | @property (copy, nonatomic) id toValue; 46 | 47 | /** 48 | @abstract The rounding factor applied to the current animated value. 49 | @discussion Specify 1.0 to animate between integral values. Defaults to 0 meaning no rounding. 50 | */ 51 | @property (assign, nonatomic) CGFloat roundingFactor; 52 | 53 | /** 54 | @abstract The clamp mode applied to the current animated value. 55 | @discussion See {@ref POPAnimationClampFlags} for possible values. Defaults to kPOPAnimationClampNone. 56 | */ 57 | @property (assign, nonatomic) NSUInteger clampMode; 58 | 59 | /** 60 | @abstract The flag indicating whether values should be "added" each frame, rather than set. 61 | @discussion Addition may be type dependent. Defaults to NO. 62 | */ 63 | @property (assign, nonatomic, getter = isAdditive) BOOL additive; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPPropertyAnimation.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPPropertyAnimationInternal.h" 11 | 12 | @implementation POPPropertyAnimation 13 | 14 | #pragma mark - Lifecycle 15 | 16 | #undef __state 17 | #define __state ((POPPropertyAnimationState *)_state) 18 | 19 | - (void)_initState 20 | { 21 | _state = new POPPropertyAnimationState(self); 22 | } 23 | 24 | #pragma mark - Properties 25 | 26 | DEFINE_RW_FLAG(POPPropertyAnimationState, additive, isAdditive, setAdditive:); 27 | DEFINE_RW_PROPERTY(POPPropertyAnimationState, roundingFactor, setRoundingFactor:, CGFloat); 28 | DEFINE_RW_PROPERTY(POPPropertyAnimationState, clampMode, setClampMode:, NSUInteger); 29 | DEFINE_RW_PROPERTY_OBJ(POPPropertyAnimationState, property, setProperty:, POPAnimatableProperty*, ((POPPropertyAnimationState*)_state)->updatedDynamicsThreshold();); 30 | DEFINE_RW_PROPERTY_OBJ_COPY(POPPropertyAnimationState, progressMarkers, setProgressMarkers:, NSArray*, ((POPPropertyAnimationState*)_state)->updatedProgressMarkers();); 31 | 32 | - (id)fromValue 33 | { 34 | return POPBox(__state->fromVec, __state->valueType); 35 | } 36 | 37 | - (void)setFromValue:(id)aValue 38 | { 39 | POPPropertyAnimationState *s = __state; 40 | VectorRef vec = POPUnbox(aValue, s->valueType, s->valueCount, YES); 41 | if (!vec_equal(vec, s->fromVec)) { 42 | s->fromVec = vec; 43 | 44 | if (s->tracing) { 45 | [s->tracer updateFromValue:aValue]; 46 | } 47 | } 48 | } 49 | 50 | - (id)toValue 51 | { 52 | return POPBox(__state->toVec, __state->valueType); 53 | } 54 | 55 | - (void)setToValue:(id)aValue 56 | { 57 | POPPropertyAnimationState *s = __state; 58 | VectorRef vec = POPUnbox(aValue, s->valueType, s->valueCount, YES); 59 | 60 | if (!vec_equal(vec, s->toVec)) { 61 | s->toVec = vec; 62 | 63 | // invalidate to dependent state 64 | s->didReachToValue = false; 65 | s->distanceVec = NULL; 66 | 67 | if (s->tracing) { 68 | [s->tracer updateToValue:aValue]; 69 | } 70 | 71 | // automatically unpause active animations 72 | if (s->active && s->paused) { 73 | s->setPaused(false); 74 | } 75 | } 76 | } 77 | 78 | - (id)currentValue 79 | { 80 | return POPBox(__state->currentValue(), __state->valueType); 81 | } 82 | 83 | #pragma mark - Utility 84 | 85 | - (void)_appendDescription:(NSMutableString *)s debug:(BOOL)debug 86 | { 87 | [s appendFormat:@"; from = %@; to = %@", describe(__state->fromVec), describe(__state->toVec)]; 88 | 89 | if (_state->active) 90 | [s appendFormat:@"; currentValue = %@", describe(__state->currentValue())]; 91 | 92 | if (__state->velocityVec && 0 != __state->velocityVec->norm()) 93 | [s appendFormat:@"; velocity = %@", describe(__state->velocityVec)]; 94 | 95 | if (!self.removedOnCompletion) 96 | [s appendFormat:@"; removedOnCompletion = %@", POPStringFromBOOL(self.removedOnCompletion)]; 97 | 98 | if (__state->progressMarkers) 99 | [s appendFormat:@"; progressMarkers = [%@]", [__state->progressMarkers componentsJoinedByString:@", "]]; 100 | 101 | if (_state->active) 102 | [s appendFormat:@"; progress = %f", __state->progress]; 103 | } 104 | 105 | @end 106 | 107 | @implementation POPPropertyAnimation (NSCopying) 108 | 109 | - (instancetype)copyWithZone:(NSZone *)zone { 110 | 111 | POPPropertyAnimation *copy = [super copyWithZone:zone]; 112 | 113 | if (copy) { 114 | copy.property = [self.property copyWithZone:zone]; 115 | copy.fromValue = self.fromValue; 116 | copy.toValue = self.toValue; 117 | copy.roundingFactor = self.roundingFactor; 118 | copy.clampMode = self.clampMode; 119 | copy.additive = self.additive; 120 | } 121 | 122 | return copy; 123 | } 124 | 125 | @end -------------------------------------------------------------------------------- /Pods/pop/pop/POPSpringAnimation.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | /** 13 | @abstract A concrete spring animation class. 14 | @discussion Animation is achieved through modeling spring dynamics. 15 | */ 16 | @interface POPSpringAnimation : POPPropertyAnimation 17 | 18 | /** 19 | @abstract The designated initializer. 20 | @returns An instance of a spring animation. 21 | */ 22 | + (instancetype)animation; 23 | 24 | /** 25 | @abstract Convenience initializer that returns an animation with animatable property of name. 26 | @param name The name of the animatable property. 27 | @returns An instance of a spring animation configured with specified animatable property. 28 | */ 29 | + (instancetype)animationWithPropertyNamed:(NSString *)name; 30 | 31 | /** 32 | @abstract The current velocity value. 33 | @discussion Set before animation start to account for initial velocity. Expressed in change of value units per second. 34 | */ 35 | @property (copy, nonatomic) id velocity; 36 | 37 | /** 38 | @abstract The effective bounciness. 39 | @discussion Use in conjunction with 'springSpeed' to change animation effect. Values are converted into corresponding dynamics constants. Higher values increase spring movement range resulting in more oscillations and springiness. Defined as a value in the range [0, 20]. Defaults to 4. 40 | */ 41 | @property (assign, nonatomic) CGFloat springBounciness; 42 | 43 | /** 44 | @abstract The effective speed. 45 | @discussion Use in conjunction with 'springBounciness' to change animation effect. Values are converted into corresponding dynamics constants. Higher values increase the dampening power of the spring resulting in a faster initial velocity and more rapid bounce slowdown. Defined as a value in the range [0, 20]. Defaults to 12. 46 | */ 47 | @property (assign, nonatomic) CGFloat springSpeed; 48 | 49 | /** 50 | @abstract The tension used in the dynamics simulation. 51 | @discussion Can be used over bounciness and speed for finer grain tweaking of animation effect. 52 | */ 53 | @property (assign, nonatomic) CGFloat dynamicsTension; 54 | 55 | /** 56 | @abstract The friction used in the dynamics simulation. 57 | @discussion Can be used over bounciness and speed for finer grain tweaking of animation effect. 58 | */ 59 | @property (assign, nonatomic) CGFloat dynamicsFriction; 60 | 61 | /** 62 | @abstract The mass used in the dynamics simulation. 63 | @discussion Can be used over bounciness and speed for finer grain tweaking of animation effect. 64 | */ 65 | @property (assign, nonatomic) CGFloat dynamicsMass; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPSpringAnimation.mm: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "POPSpringAnimationInternal.h" 11 | 12 | @implementation POPSpringAnimation 13 | 14 | #pragma mark - Lifecycle 15 | 16 | #undef __state 17 | #define __state ((POPSpringAnimationState *)_state) 18 | 19 | + (instancetype)animation 20 | { 21 | return [[self alloc] init]; 22 | } 23 | 24 | + (instancetype)animationWithPropertyNamed:(NSString *)aName 25 | { 26 | POPSpringAnimation *anim = [self animation]; 27 | anim.property = [POPAnimatableProperty propertyWithName:aName]; 28 | return anim; 29 | } 30 | 31 | - (void)_initState 32 | { 33 | _state = new POPSpringAnimationState(self); 34 | } 35 | 36 | - (id)init 37 | { 38 | self = [super _init]; 39 | if (nil != self) { 40 | __state->solver = new SpringSolver4d(1, 1, 1); 41 | __state->updatedDynamicsThreshold(); 42 | __state->updatedBouncinessAndSpeed(); 43 | } 44 | return self; 45 | } 46 | 47 | - (void)dealloc 48 | { 49 | if (__state) { 50 | delete __state->solver; 51 | __state->solver = NULL; 52 | } 53 | } 54 | 55 | #pragma mark - Properties 56 | 57 | - (id)velocity 58 | { 59 | return POPBox(__state->velocityVec, __state->valueType); 60 | } 61 | 62 | - (void)setVelocity:(id)aValue 63 | { 64 | POPPropertyAnimationState *s = __state; 65 | VectorRef vec = POPUnbox(aValue, s->valueType, s->valueCount, YES); 66 | VectorRef origVec = POPUnbox(aValue, s->valueType, s->valueCount, YES); 67 | if (!vec_equal(vec, s->velocityVec)) { 68 | s->velocityVec = vec; 69 | s->originalVelocityVec = origVec; 70 | 71 | if (s->tracing) { 72 | [s->tracer updateVelocity:aValue]; 73 | } 74 | } 75 | } 76 | 77 | DEFINE_RW_PROPERTY(POPSpringAnimationState, dynamicsTension, setDynamicsTension:, CGFloat, [self _updatedDynamicsTension];); 78 | DEFINE_RW_PROPERTY(POPSpringAnimationState, dynamicsFriction, setDynamicsFriction:, CGFloat, [self _updatedDynamicsFriction];); 79 | DEFINE_RW_PROPERTY(POPSpringAnimationState, dynamicsMass, setDynamicsMass:, CGFloat, [self _updatedDynamicsMass];); 80 | 81 | FB_PROPERTY_GET(POPSpringAnimationState, springSpeed, CGFloat); 82 | - (void)setSpringSpeed:(CGFloat)aFloat 83 | { 84 | POPSpringAnimationState *s = __state; 85 | if (s->userSpecifiedDynamics || aFloat != s->springSpeed) { 86 | s->springSpeed = aFloat; 87 | s->userSpecifiedDynamics = false; 88 | s->updatedBouncinessAndSpeed(); 89 | if (s->tracing) { 90 | [s->tracer updateSpeed:aFloat]; 91 | } 92 | } 93 | } 94 | 95 | FB_PROPERTY_GET(POPSpringAnimationState, springBounciness, CGFloat); 96 | - (void)setSpringBounciness:(CGFloat)aFloat 97 | { 98 | POPSpringAnimationState *s = __state; 99 | if (s->userSpecifiedDynamics || aFloat != s->springBounciness) { 100 | s->springBounciness = aFloat; 101 | s->userSpecifiedDynamics = false; 102 | s->updatedBouncinessAndSpeed(); 103 | if (s->tracing) { 104 | [s->tracer updateBounciness:aFloat]; 105 | } 106 | } 107 | } 108 | 109 | - (SpringSolver4d *)solver 110 | { 111 | return __state->solver; 112 | } 113 | 114 | - (void)setSolver:(SpringSolver4d *)aSolver 115 | { 116 | if (aSolver != __state->solver) { 117 | if (__state->solver) { 118 | delete(__state->solver); 119 | } 120 | __state->solver = aSolver; 121 | } 122 | } 123 | 124 | #pragma mark - Utility 125 | 126 | - (void)_updatedDynamicsTension 127 | { 128 | __state->userSpecifiedDynamics = true; 129 | if(__state->tracing) { 130 | [__state->tracer updateTension:__state->dynamicsTension]; 131 | } 132 | __state->updatedDynamics(); 133 | } 134 | 135 | - (void)_updatedDynamicsFriction 136 | { 137 | __state->userSpecifiedDynamics = true; 138 | if(__state->tracing) { 139 | [__state->tracer updateFriction:__state->dynamicsFriction]; 140 | } 141 | __state->updatedDynamics(); 142 | } 143 | 144 | - (void)_updatedDynamicsMass 145 | { 146 | __state->userSpecifiedDynamics = true; 147 | if(__state->tracing) { 148 | [__state->tracer updateMass:__state->dynamicsMass]; 149 | } 150 | __state->updatedDynamics(); 151 | } 152 | 153 | - (void)_appendDescription:(NSMutableString *)s debug:(BOOL)debug 154 | { 155 | [super _appendDescription:s debug:debug]; 156 | 157 | if (debug) { 158 | if (_state->userSpecifiedDynamics) { 159 | [s appendFormat:@"; dynamics = (tension:%f, friction:%f, mass:%f)", __state->dynamicsTension, __state->dynamicsFriction, __state->dynamicsMass]; 160 | } else { 161 | [s appendFormat:@"; bounciness = %f; speed = %f", __state->springBounciness, __state->springSpeed]; 162 | } 163 | } 164 | } 165 | 166 | @end 167 | 168 | @implementation POPSpringAnimation (NSCopying) 169 | 170 | - (instancetype)copyWithZone:(NSZone *)zone { 171 | 172 | POPSpringAnimation *copy = [super copyWithZone:zone]; 173 | 174 | if (copy) { 175 | id velocity = POPBox(__state->originalVelocityVec, __state->valueType); 176 | 177 | // If velocity never gets set, then POPBox will return nil, messing up __state->valueCount. 178 | if (velocity) { 179 | copy.velocity = velocity; 180 | } 181 | 182 | copy.springBounciness = self.springBounciness; 183 | copy.springSpeed = self.springSpeed; 184 | copy.dynamicsTension = self.dynamicsTension; 185 | copy.dynamicsFriction = self.dynamicsFriction; 186 | copy.dynamicsMass = self.dynamicsMass; 187 | } 188 | 189 | return copy; 190 | } 191 | 192 | @end -------------------------------------------------------------------------------- /Pods/pop/pop/POPSpringAnimationInternal.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "POPAnimationExtras.h" 13 | #import "POPPropertyAnimationInternal.h" 14 | 15 | struct _POPSpringAnimationState : _POPPropertyAnimationState 16 | { 17 | SpringSolver4d *solver; 18 | CGFloat springSpeed; 19 | CGFloat springBounciness; // normalized springiness 20 | CGFloat dynamicsTension; // tension 21 | CGFloat dynamicsFriction; // friction 22 | CGFloat dynamicsMass; // mass 23 | 24 | _POPSpringAnimationState(id __unsafe_unretained anim) : _POPPropertyAnimationState(anim), 25 | solver(nullptr), 26 | springSpeed(12.), 27 | springBounciness(4.), 28 | dynamicsTension(0), 29 | dynamicsFriction(0), 30 | dynamicsMass(0) 31 | { 32 | type = kPOPAnimationSpring; 33 | } 34 | 35 | bool hasConverged() 36 | { 37 | NSUInteger count = valueCount; 38 | if (shouldRound()) { 39 | return vec_equal(previous2Vec, previousVec) && vec_equal(previousVec, toVec); 40 | } else { 41 | if (!previousVec || !previous2Vec) 42 | return false; 43 | 44 | CGFloat t = dynamicsThreshold / 5; 45 | 46 | const CGFloat *toValues = toVec->data(); 47 | const CGFloat *previousValues = previousVec->data(); 48 | const CGFloat *previous2Values = previous2Vec->data(); 49 | 50 | for (NSUInteger idx = 0; idx < count; idx++) { 51 | if ((std::abs(toValues[idx] - previousValues[idx]) >= t) || (std::abs(previous2Values[idx] - previousValues[idx]) >= t)) { 52 | return false; 53 | } 54 | } 55 | return true; 56 | } 57 | } 58 | 59 | bool isDone() { 60 | if (_POPPropertyAnimationState::isDone()) { 61 | return true; 62 | } 63 | return solver->started() && (hasConverged() || solver->hasConverged()); 64 | } 65 | 66 | void updatedDynamics() 67 | { 68 | if (NULL != solver) { 69 | solver->setConstants(dynamicsTension, dynamicsFriction, dynamicsMass); 70 | } 71 | } 72 | 73 | void updatedDynamicsThreshold() 74 | { 75 | _POPPropertyAnimationState::updatedDynamicsThreshold(); 76 | if (NULL != solver) { 77 | solver->setThreshold(dynamicsThreshold); 78 | } 79 | } 80 | 81 | void updatedBouncinessAndSpeed() { 82 | [POPSpringAnimation convertBounciness:springBounciness speed:springSpeed toTension:&dynamicsTension friction:&dynamicsFriction mass:&dynamicsMass]; 83 | updatedDynamics(); 84 | } 85 | 86 | bool advance(CFTimeInterval time, CFTimeInterval dt, id obj) { 87 | // advance past not yet initialized animations 88 | if (NULL == currentVec) { 89 | return false; 90 | } 91 | 92 | CFTimeInterval localTime = time - startTime; 93 | 94 | Vector4d value = vector4d(currentVec); 95 | Vector4d toValue = vector4d(toVec); 96 | Vector4d velocity = vector4d(velocityVec); 97 | 98 | SSState4d state; 99 | state.p = toValue - value; 100 | 101 | // the solver assumes a spring of size zero 102 | // flip the velocity from user perspective to solver perspective 103 | state.v = velocity * -1; 104 | 105 | solver->advance(state, localTime, dt); 106 | value = toValue - state.p; 107 | 108 | // flip velocity back to user perspective 109 | velocity = state.v * -1; 110 | 111 | *currentVec = value; 112 | 113 | if (velocityVec) { 114 | *velocityVec = velocity; 115 | } 116 | 117 | clampCurrentValue(); 118 | 119 | return true; 120 | } 121 | 122 | virtual void reset(bool all) { 123 | _POPPropertyAnimationState::reset(all); 124 | 125 | if (solver) { 126 | solver->setConstants(dynamicsTension, dynamicsFriction, dynamicsMass); 127 | solver->reset(); 128 | } 129 | } 130 | }; 131 | 132 | typedef struct _POPSpringAnimationState POPSpringAnimationState; 133 | -------------------------------------------------------------------------------- /Pods/pop/pop/POPSpringSolver.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "POPVector.h" 13 | 14 | namespace POP { 15 | 16 | template 17 | struct SSState 18 | { 19 | T p; 20 | T v; 21 | }; 22 | 23 | template 24 | struct SSDerivative 25 | { 26 | T dp; 27 | T dv; 28 | }; 29 | 30 | typedef SSState SSState4d; 31 | typedef SSDerivative SSDerivative4d; 32 | 33 | const CFTimeInterval solverDt = 0.001f; 34 | const CFTimeInterval maxSolverDt = 30.0f; 35 | 36 | /** 37 | Templated spring solver class. 38 | */ 39 | template 40 | class SpringSolver 41 | { 42 | double _k; // stiffness 43 | double _b; // dampening 44 | double _m; // mass 45 | 46 | double _tp; // threshold 47 | double _tv; // threshold velocity 48 | double _ta; // threshold acceleration 49 | 50 | CFTimeInterval _accumulatedTime; 51 | SSState _lastState; 52 | T _lastDv; 53 | bool _started; 54 | 55 | public: 56 | SpringSolver(double k, double b, double m = 1) : _k(k), _b(b), _m(m), _started(false) 57 | { 58 | _accumulatedTime = 0; 59 | _lastState.p = T::Zero(); 60 | _lastState.v = T::Zero(); 61 | _lastDv = T::Zero(); 62 | setThreshold(1.); 63 | } 64 | 65 | ~SpringSolver() 66 | { 67 | } 68 | 69 | bool started() 70 | { 71 | return _started; 72 | } 73 | 74 | void setConstants(double k, double b, double m) 75 | { 76 | _k = k; 77 | _b = b; 78 | _m = m; 79 | } 80 | 81 | void setThreshold(double t) 82 | { 83 | _tp = t / 2; // half a unit 84 | _tv = 25.0 * t; // 5 units per second, squared for comparison 85 | _ta = 625.0 * t * t; // 5 units per second squared, squared for comparison 86 | } 87 | 88 | T acceleration(const SSState &state, double t) 89 | { 90 | return state.p*(-_k/_m) - state.v*(_b/_m); 91 | } 92 | 93 | SSDerivative evaluate(const SSState &initial, double t) 94 | { 95 | SSDerivative output; 96 | output.dp = initial.v; 97 | output.dv = acceleration(initial, t); 98 | return output; 99 | } 100 | 101 | SSDerivative evaluate(const SSState &initial, double t, double dt, const SSDerivative &d) 102 | { 103 | SSState state; 104 | state.p = initial.p + d.dp*dt; 105 | state.v = initial.v + d.dv*dt; 106 | SSDerivative output; 107 | output.dp = state.v; 108 | output.dv = acceleration(state, t+dt); 109 | return output; 110 | } 111 | 112 | void integrate(SSState &state, double t, double dt) 113 | { 114 | SSDerivative a = evaluate(state, t); 115 | SSDerivative b = evaluate(state, t, dt*0.5, a); 116 | SSDerivative c = evaluate(state, t, dt*0.5, b); 117 | SSDerivative d = evaluate(state, t, dt, c); 118 | 119 | T dpdt = (a.dp + (b.dp + c.dp)*2.0 + d.dp) * (1.0/6.0); 120 | T dvdt = (a.dv + (b.dv + c.dv)*2.0 + d.dv) * (1.0/6.0); 121 | 122 | state.p = state.p + dpdt*dt; 123 | state.v = state.v + dvdt*dt; 124 | 125 | _lastDv = dvdt; 126 | } 127 | 128 | SSState interpolate(const SSState &previous, const SSState ¤t, double alpha) 129 | { 130 | SSState state; 131 | state.p = current.p*alpha + previous.p*(1-alpha); 132 | state.v = current.v*alpha + previous.v*(1-alpha); 133 | return state; 134 | } 135 | 136 | void advance(SSState &state, double t, double dt) 137 | { 138 | _started = true; 139 | 140 | if (dt > maxSolverDt) { 141 | // excessive time step, force shut down 142 | _lastDv = _lastState.v = _lastState.p = T::Zero(); 143 | } else { 144 | _accumulatedTime += dt; 145 | 146 | SSState previousState = state, currentState = state; 147 | while (_accumulatedTime >= solverDt) { 148 | previousState = currentState; 149 | this->integrate(currentState, t, solverDt); 150 | t += solverDt; 151 | _accumulatedTime -= solverDt; 152 | } 153 | CFTimeInterval alpha = _accumulatedTime / solverDt; 154 | _lastState = state = this->interpolate(previousState, currentState, alpha); 155 | } 156 | } 157 | 158 | bool hasConverged() 159 | { 160 | if (!_started) { 161 | return false; 162 | } 163 | 164 | for (size_t idx = 0; idx < _lastState.p.size(); idx++) { 165 | if (fabs(_lastState.p(idx)) >= _tp) { 166 | return false; 167 | } 168 | } 169 | 170 | return (_lastState.v.squaredNorm() < _tv) && (_lastDv.squaredNorm() < _ta); 171 | } 172 | 173 | void reset() 174 | { 175 | _accumulatedTime = 0; 176 | _lastState.p = T::Zero(); 177 | _lastState.v = T::Zero(); 178 | _lastDv = T::Zero(); 179 | _started = false; 180 | } 181 | }; 182 | 183 | /** 184 | Convenience spring solver type definitions. 185 | */ 186 | typedef SpringSolver SpringSolver2d; 187 | typedef SpringSolver SpringSolver3d; 188 | typedef SpringSolver SpringSolver4d; 189 | } 190 | 191 | -------------------------------------------------------------------------------- /Pods/pop/pop/WebCore/FloatConversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 14 | * its contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef FloatConversion_h 30 | #define FloatConversion_h 31 | 32 | #include 33 | 34 | namespace WebCore { 35 | 36 | template 37 | float narrowPrecisionToFloat(T); 38 | 39 | template<> 40 | inline float narrowPrecisionToFloat(double number) 41 | { 42 | return static_cast(number); 43 | } 44 | 45 | template 46 | CGFloat narrowPrecisionToCGFloat(T); 47 | 48 | template<> 49 | inline CGFloat narrowPrecisionToCGFloat(double number) 50 | { 51 | return static_cast(number); 52 | } 53 | 54 | } // namespace WebCore 55 | 56 | #endif // FloatConversion_h 57 | -------------------------------------------------------------------------------- /Pods/pop/pop/WebCore/UnitBezier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Apple Inc. All Rights Reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef UnitBezier_h 27 | #define UnitBezier_h 28 | 29 | #include 30 | 31 | namespace WebCore { 32 | 33 | struct UnitBezier { 34 | UnitBezier(double p1x, double p1y, double p2x, double p2y) 35 | { 36 | // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1). 37 | cx = 3.0 * p1x; 38 | bx = 3.0 * (p2x - p1x) - cx; 39 | ax = 1.0 - cx -bx; 40 | 41 | cy = 3.0 * p1y; 42 | by = 3.0 * (p2y - p1y) - cy; 43 | ay = 1.0 - cy - by; 44 | } 45 | 46 | double sampleCurveX(double t) 47 | { 48 | // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule. 49 | return ((ax * t + bx) * t + cx) * t; 50 | } 51 | 52 | double sampleCurveY(double t) 53 | { 54 | return ((ay * t + by) * t + cy) * t; 55 | } 56 | 57 | double sampleCurveDerivativeX(double t) 58 | { 59 | return (3.0 * ax * t + 2.0 * bx) * t + cx; 60 | } 61 | 62 | // Given an x value, find a parametric value it came from. 63 | double solveCurveX(double x, double epsilon) 64 | { 65 | double t0; 66 | double t1; 67 | double t2; 68 | double x2; 69 | double d2; 70 | int i; 71 | 72 | // First try a few iterations of Newton's method -- normally very fast. 73 | for (t2 = x, i = 0; i < 8; i++) { 74 | x2 = sampleCurveX(t2) - x; 75 | if (fabs (x2) < epsilon) 76 | return t2; 77 | d2 = sampleCurveDerivativeX(t2); 78 | if (fabs(d2) < 1e-6) 79 | break; 80 | t2 = t2 - x2 / d2; 81 | } 82 | 83 | // Fall back to the bisection method for reliability. 84 | t0 = 0.0; 85 | t1 = 1.0; 86 | t2 = x; 87 | 88 | if (t2 < t0) 89 | return t0; 90 | if (t2 > t1) 91 | return t1; 92 | 93 | while (t0 < t1) { 94 | x2 = sampleCurveX(t2); 95 | if (fabs(x2 - x) < epsilon) 96 | return t2; 97 | if (x > x2) 98 | t0 = t2; 99 | else 100 | t1 = t2; 101 | t2 = (t1 - t0) * .5 + t0; 102 | } 103 | 104 | // Failure. 105 | return t2; 106 | } 107 | 108 | double solve(double x, double epsilon) 109 | { 110 | return sampleCurveY(solveCurveX(x, epsilon)); 111 | } 112 | 113 | private: 114 | double ax; 115 | double bx; 116 | double cx; 117 | 118 | double ay; 119 | double by; 120 | double cy; 121 | }; 122 | } 123 | #endif 124 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ZFCityGuides 2 | 使用方法: 3 | 4 | 1. 打开.xcworkspace编译运行即可 5 | 6 | 高仿City Guides 动画效果 7 | 8 | 详细参见简书: 9 | 10 | [干货系列之实现City Guides的动画效果(一)](http://www.jianshu.com/p/d8e7cc5b307b) 11 | 12 | [干货系列之实现City Guides的动画效果(二)](http://www.jianshu.com/p/4bebbb4bfc38) 13 | 14 | 此demo仅供学习交流使用。 15 | 16 | 部分动画效果: 17 | 18 | 动画效果1: 19 |

20 | 21 |

22 | 23 | 动画效果2: 24 |

25 | 26 |

27 | 28 | 动画效果3: 29 | 30 |

31 | 32 |

33 | 34 | 动画效果4: 35 | 36 |

37 | 38 |

39 | 动画效果5: 40 | 41 |

42 | 43 |

44 | 45 | 动画效果6: 46 | 47 |

48 | 49 |

50 | 51 | -------------------------------------------------------------------------------- /ZFCityGuides.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ZFCityGuides.xcodeproj/project.xcworkspace/xcuserdata/macOne.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides.xcodeproj/project.xcworkspace/xcuserdata/macOne.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ZFCityGuides.xcodeproj/xcuserdata/macOne.xcuserdatad/xcschemes/ZFCityGuides.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ZFCityGuides.xcodeproj/xcuserdata/macOne.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ZFCityGuides.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | DB6D93DD1C434C10001465A9 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ZFCityGuides.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ZFCityGuides.xcworkspace/xcuserdata/macOne.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides.xcworkspace/xcuserdata/macOne.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ZFCityGuides.xcworkspace/xcuserdata/macOne.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 56 | 68 | 69 | 70 | 72 | 84 | 85 | 86 | 88 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /ZFCityGuides/AnimationControllers/NavigationAnimationViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavigationAnimationViewController.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/1. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NavigationAnimationViewController : NSObject 12 | 13 | @property (nonatomic, getter=isPushed,assign) BOOL bPush; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ZFCityGuides/AnimationControllers/PresentAnimationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PresentAnimationController.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/15. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PresentAnimationController : NSObject 12 | 13 | 14 | @property (nonatomic, getter=isDismissed,assign) BOOL dismiss; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ZFCityGuides/AnimationControllers/TabBarAnimationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TabBarAnimationController.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/27. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TabBarAnimationController : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZFCityGuides/AnimationControllers/TabBarAnimationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TabBarAnimationController.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/27. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "TabBarAnimationController.h" 10 | 11 | @implementation TabBarAnimationController 12 | 13 | - (NSTimeInterval)transitionDuration:(nullable id )transitionContext{ 14 | 15 | return 1.0; 16 | } 17 | 18 | - (void)animateTransition:(id )transitionContext{ 19 | 20 | UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 21 | UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; 22 | 23 | UIView *fromView = fromVC.view; 24 | UIView *toView = toVC.view; 25 | 26 | 27 | UIView* containerView = [transitionContext containerView]; 28 | 29 | 30 | [toVC beginAppearanceTransition:YES animated:YES]; 31 | 32 | CGRect frame = [transitionContext initialFrameForViewController:fromVC]; 33 | 34 | CGRect offScreenFrame = frame; 35 | offScreenFrame.origin.y = -offScreenFrame.size.height; 36 | toView.frame = offScreenFrame; 37 | 38 | CGRect fromViewFrame = frame; 39 | fromViewFrame.origin.y = fromViewFrame.size.height; 40 | 41 | [containerView addSubview:toView]; 42 | 43 | //toView初始状态 44 | CATransform3D t1 = CATransform3DIdentity; 45 | t1.m34 = 1.0/-500; 46 | //x顺时针 转60度 47 | t1 = CATransform3DRotate(t1, DEGREES_TO_RADIANS(60), 1, 0, 0); 48 | //x y 方向缩放 49 | t1 = CATransform3DScale(t1,0.2, 0.2, 1); 50 | //动画加入到toView 51 | toView.layer.transform = t1; 52 | 53 | [UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 54 | //fromView 下移消失 55 | fromView.frame = fromViewFrame; 56 | //toView 下移出现 57 | toView.frame = frame; 58 | //还原3d 59 | toView.layer.transform = CATransform3DIdentity; 60 | 61 | } completion:^(BOOL finished) { 62 | 63 | [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; 64 | }]; 65 | 66 | [fromVC beginAppearanceTransition:NO animated:YES]; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /ZFCityGuides/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/11. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MainNavigationController.h" 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @property (nonatomic, strong) MainNavigationController *rootNavigation; 17 | 18 | + (AppDelegate *)shareDelegate; 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /ZFCityGuides/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/11. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | + (AppDelegate *)shareDelegate 18 | { 19 | return (AppDelegate *)[[UIApplication sharedApplication] delegate]; 20 | } 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | // Override point for customization after application launch. 24 | 25 | 26 | //统一设置为白色 info.plist ----View controller-based status bar appearance:NO 27 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 28 | 29 | 30 | return YES; 31 | } 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application { 34 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 35 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 36 | } 37 | 38 | - (void)applicationDidEnterBackground:(UIApplication *)application { 39 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application { 44 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 45 | } 46 | 47 | - (void)applicationDidBecomeActive:(UIApplication *)application { 48 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 49 | } 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /ZFCityGuides/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /ZFCityGuides/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ZFCityGuides/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ZFCityGuides/Category/UIImage+UIColor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+UIColor.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/28. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (UIColor) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZFCityGuides/Category/UIImage+UIColor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+UIColor.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/28. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "UIImage+UIColor.h" 10 | 11 | @implementation UIImage (UIColor) 12 | 13 | 14 | - (UIImage*) createImageWithColor: (UIColor*) color 15 | { 16 | CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 17 | UIGraphicsBeginImageContext(rect.size); 18 | CGContextRef context = UIGraphicsGetCurrentContext(); 19 | CGContextSetFillColorWithColor(context, [color CGColor]); 20 | CGContextFillRect(context, rect); 21 | UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); 22 | UIGraphicsEndImageContext(); 23 | return theImage; 24 | } 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ZFCityGuides/Category/UINavigationController+Interactive.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+Interactive.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/2. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UINavigationController (Interactive) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZFCityGuides/Category/UINavigationController+Interactive.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+Interactive.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/2. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "UINavigationController+Interactive.h" 10 | #import 11 | 12 | @implementation UINavigationController (Interactive) 13 | 14 | 15 | + (void)load{ 16 | //方法交换应该被保证,在程序中只会执行一次 17 | static dispatch_once_t onceToken; 18 | dispatch_once(&onceToken, ^{ 19 | 20 | //获得viewController的生命周期方法的selector 21 | SEL orignSelector = @selector(pushViewController:animated:); 22 | //自己实现的将要被交换的方法的selector 23 | SEL swizzleSelector = @selector(swizzle_pushViewController:animated:); 24 | //两个方法的Method 25 | Method orignMethod = class_getInstanceMethod([self class], orignSelector); 26 | Method swizzleMethod = class_getInstanceMethod([self class], swizzleSelector); 27 | 28 | //首先动态添加方法,实现是被交换的方法,返回值表示添加成功还是失败 29 | BOOL isAdd = class_addMethod(self, orignSelector, method_getImplementation(swizzleMethod), method_getTypeEncoding(swizzleMethod)); 30 | if (isAdd) { 31 | //如果成功,说明类中不存在这个方法的实现 32 | //将被交换方法的实现替换到这个并不存在的实现 33 | class_replaceMethod(self, swizzleSelector, method_getImplementation(orignMethod), method_getTypeEncoding(orignMethod)); 34 | }else{ 35 | //否则,交换两个方法的实现 36 | method_exchangeImplementations(orignMethod, swizzleMethod); 37 | } 38 | 39 | }); 40 | } 41 | 42 | - (void)swizzle_pushViewController:(UIViewController *)viewController animated:(BOOL)animated{ 43 | 44 | MainNavigationController *navigation = (MainNavigationController *)self; 45 | navigation.interactionViewController = [ZFNavInteractiveTransition new]; 46 | 47 | [self swizzle_pushViewController:viewController animated:animated]; 48 | 49 | 50 | } 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /ZFCityGuides/ConstantValue.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConstantValue.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/11. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #ifndef ConstantValue_h 10 | #define ConstantValue_h 11 | 12 | 13 | #endif /* ConstantValue_h */ 14 | 15 | #define kUIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] 16 | 17 | #define DEGREES_TO_RADIANS(x) ((x) / 180.0 * M_PI) 18 | 19 | #define IOSVersion ([[[UIDevice currentDevice] systemVersion] floatValue]) 20 | //视图frame改变通知 21 | #define kChangedFrame @"kChangedViewFrame" 22 | 23 | //控件背景颜色 button label cell 等 24 | #define kControlBgColor kUIColorFromRGB(0xedeef0) 25 | //按钮文字颜色 有所区分 26 | #define kButtonTextTintColor kUIColorFromRGB(0x3f484a) 27 | //文字颜色 28 | #define kTextlightBlueColor kUIColorFromRGB(0x272d2d) 29 | //navigation 背景颜色 30 | #define kNavBgColor kUIColorFromRGB(0x1f2324) 31 | //视图背景颜色 UIView 32 | #define kViewBgColor kUIColorFromRGB(0x292d2e) 33 | //tabItem 背景正常颜色 34 | #define kTabItemBgNormal kUIColorFromRGB(0x1e2225) 35 | //tabItem 背景选中颜色 36 | #define kTabItemBgSelected kUIColorFromRGB(0x1a9fd0) 37 | //tabItem 字体颜色 38 | #define kTabItemTextNormal kUIColorFromRGB(0xa3bac5) 39 | //contenView 背景颜色 40 | #define kContentViewBgColor kUIColorFromRGB(0x272c2f) 41 | 42 | #define kSegmentBorderColor kUIColorFromRGB(0x202528) 43 | //小视图cell的背景颜色 44 | #define kSmallViewBgColor kUIColorFromRGB(0x252b2b) 45 | // 46 | #define kTableViewCellBgColor kUIColorFromRGB(0xf7f7f7) 47 | //子视图上的字体颜色 灰色 48 | #define kTextlightGrayColor kUIColorFromRGB(0xb1bcc0) 49 | 50 | #define TitleBoldFontName @"TrumpGothicEast-Bold" 51 | 52 | #define TitleFontName @"FilmotypeGiant" 53 | 54 | #define BodyFontName @"HelveticaNeue-Bold" 55 | 56 | 57 | -------------------------------------------------------------------------------- /ZFCityGuides/GlobalFunction.h: -------------------------------------------------------------------------------- 1 | // 2 | // GlobalFunction.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/15. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GlobalFunction : NSObject 12 | 13 | 14 | extern CATransform3D CATransform3DMakePerspective(CGPoint center, float disZ); 15 | 16 | extern CATransform3D CATransform3DPerspect(CATransform3D t, CGPoint center, float disZ); 17 | 18 | extern UIColor* randomColor(); 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ZFCityGuides/GlobalFunction.m: -------------------------------------------------------------------------------- 1 | // 2 | // GlobalFunction.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/15. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "GlobalFunction.h" 10 | 11 | @implementation GlobalFunction 12 | 13 | #pragma mark -投影转换 14 | 15 | CATransform3D CATransform3DMakePerspective(CGPoint center, float disZ) 16 | { 17 | CATransform3D transToCenter = CATransform3DMakeTranslation(-center.x, -center.y, 0); 18 | CATransform3D transBack = CATransform3DMakeTranslation(center.x, center.y, 0); 19 | CATransform3D scale = CATransform3DIdentity; 20 | scale.m34 = -1.0f/disZ; 21 | return CATransform3DConcat(CATransform3DConcat(transToCenter, scale), transBack); 22 | } 23 | 24 | CATransform3D CATransform3DPerspect(CATransform3D t, CGPoint center, float disZ) 25 | { 26 | return CATransform3DConcat(t, CATransform3DMakePerspective(center, disZ)); 27 | } 28 | 29 | #pragma mark -随机颜色 30 | 31 | UIColor* randomColor() 32 | { 33 | CGFloat hue = ( arc4random() % 256 / 256.0 ); //0.0 to 1.0 34 | CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0,away from white 35 | CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; //0.5 to 1.0,away from black 36 | return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; 37 | } 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ZFCityGuides/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIAppFonts 26 | 27 | TrumpGothicEast.ttf 28 | TrumpGothicEast-Bold.ttf 29 | FilmotypeGiant.otf 30 | 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main 35 | UIRequiredDeviceCapabilities 36 | 37 | armv7 38 | 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | UISupportedInterfaceOrientations~ipad 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationPortraitUpsideDown 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UIViewControllerBasedStatusBarAppearance 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ZFCityGuides/NavigationController/MainNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainNavigationController.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/27. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ZFNavInteractiveTransition.h" 11 | 12 | @interface MainNavigationController : UINavigationController 13 | 14 | @property (strong,nonatomic) ZFNavInteractiveTransition *interactionViewController; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ZFCityGuides/NavigationController/MainNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainNavigationController.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/27. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "MainNavigationController.h" 10 | 11 | @interface MainNavigationController () 12 | 13 | @end 14 | 15 | @implementation MainNavigationController 16 | 17 | 18 | +(void)initialize{ 19 | //配置全局的navigation bar 20 | 21 | [[UINavigationBar appearance] setBarTintColor:kContentViewBgColor]; 22 | //取消半透明 23 | [UINavigationBar appearance].translucent = NO; 24 | //去掉横线 25 | [[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; 26 | [[UINavigationBar appearance] setShadowImage:[UIImage new]]; 27 | 28 | 29 | } 30 | 31 | 32 | -(instancetype)init{ 33 | 34 | self = [super init]; 35 | if (self) { 36 | self.delegate = self; 37 | } 38 | 39 | return self; 40 | 41 | } 42 | 43 | - (void)viewDidLoad { 44 | [super viewDidLoad]; 45 | // Do any additional setup after loading the view. 46 | self.delegate = self; 47 | 48 | self.interactivePopGestureRecognizer.delegate =(id)self; 49 | 50 | self.interactivePopGestureRecognizer.enabled = YES; 51 | 52 | } 53 | 54 | 55 | - (id)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC { 56 | 57 | 58 | if (_interactionViewController) { 59 | _interactionViewController.interactionOperationPop = (operation == UINavigationControllerOperationPop); 60 | [_interactionViewController interactionForViewController:toVC]; 61 | } 62 | 63 | 64 | NavigationAnimationViewController *navigationAnimation = [NavigationAnimationViewController new]; 65 | navigationAnimation.bPush = (operation == UINavigationControllerOperationPush); 66 | 67 | return navigationAnimation; 68 | } 69 | 70 | - (id )navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id ) animationController { 71 | 72 | 73 | return _interactionViewController.interactionInProgress ? _interactionViewController: nil; 74 | } 75 | 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /ZFCityGuides/NavigationController/UINavigationController+Interactive.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+Interactive.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/2. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UINavigationController (Interactive) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZFCityGuides/NavigationController/UINavigationController+Interactive.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+Interactive.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/2. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "UINavigationController+Interactive.h" 10 | #import 11 | 12 | @implementation UINavigationController (Interactive) 13 | 14 | 15 | + (void)load{ 16 | //方法交换应该被保证,在程序中只会执行一次 17 | static dispatch_once_t onceToken; 18 | dispatch_once(&onceToken, ^{ 19 | 20 | //获得viewController的生命周期方法的selector 21 | SEL orignSelector = @selector(pushViewController:animated:); 22 | //自己实现的将要被交换的方法的selector 23 | SEL swizzleSelector = @selector(swizzle_pushViewController:animated:); 24 | //两个方法的Method 25 | Method orignMethod = class_getInstanceMethod([self class], orignSelector); 26 | Method swizzleMethod = class_getInstanceMethod([self class], swizzleSelector); 27 | 28 | //首先动态添加方法,实现是被交换的方法,返回值表示添加成功还是失败 29 | BOOL isAdd = class_addMethod(self, orignSelector, method_getImplementation(swizzleMethod), method_getTypeEncoding(swizzleMethod)); 30 | if (isAdd) { 31 | //如果成功,说明类中不存在这个方法的实现 32 | //将被交换方法的实现替换到这个并不存在的实现 33 | class_replaceMethod(self, swizzleSelector, method_getImplementation(orignMethod), method_getTypeEncoding(orignMethod)); 34 | }else{ 35 | //否则,交换两个方法的实现 36 | method_exchangeImplementations(orignMethod, swizzleMethod); 37 | } 38 | 39 | }); 40 | } 41 | 42 | - (void)swizzle_pushViewController:(UIViewController *)viewController animated:(BOOL)animated{ 43 | 44 | MainNavigationController *navigation = (MainNavigationController *)self; 45 | navigation.interactionViewController = [ZFNavInteractiveTransition new]; 46 | 47 | [self swizzle_pushViewController:viewController animated:animated]; 48 | 49 | 50 | } 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFCityGuides-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // ZFCityGuides-Prefix.pch 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/22. 6 | // Copyright (c) 2015年 wzhf. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | #ifndef __IPHONE_3_0 13 | #warning "This project uses features only available in iOS SDK 3.0 and later." 14 | #endif 15 | /** 16 | * 预加载文件:应用启动时会优先加载该文件 17 | */ 18 | #ifdef __OBJC__ 19 | 20 | #import 21 | #import 22 | 23 | #import "GlobalFunction.h" 24 | 25 | #import "ConstantValue.h" 26 | #import "AppDelegate.h" 27 | #import 28 | 29 | 30 | #import "UIImage+UIColor.h" 31 | #import "BaseViewController.h" 32 | #import "NavigationAnimationViewController.h" 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFGradientView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFGradientView.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/16. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZFGradientView : UIView 12 | 13 | @property (nonatomic, assign) CGFloat lowTemperature; 14 | 15 | @property (nonatomic, assign) CGFloat highTemperature; 16 | 17 | @property (nonatomic,assign) BOOL digitAnimated; 18 | 19 | -(void)increaseNumber:(BOOL)bIncreased animated:(BOOL)animated; 20 | @end 21 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFLayoutButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFLayoutButton.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/11. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZFLayoutButton : UIButton 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFLayoutButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZFLayoutButton.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/11. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "ZFLayoutButton.h" 10 | 11 | @implementation ZFLayoutButton 12 | 13 | 14 | -(void)setHighlighted:(BOOL)highlighted{ 15 | 16 | } 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFRainDropView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFRainDropView.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/15. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZFRainDropView : UIView 12 | 13 | @property (nonatomic,strong) NSString *pastMonthRainDrop; 14 | 15 | @property (nonatomic,strong) NSString *nearstMonthRainDrop; 16 | 17 | @property (nonatomic,assign) BOOL digitAnimated; 18 | 19 | -(instancetype)initWithFrame:(CGRect)frame; 20 | 21 | -(void)increaseNumber:(BOOL)bIncreased animated:(BOOL)animated; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFScrollView/ZFScrollViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFScrollViewCell.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/14. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol ZFScrollViewCellDelegate 12 | 13 | -(void) touchCellViewAtIndex:(NSInteger)index; 14 | 15 | @end 16 | 17 | @interface ZFScrollViewCell : UIView 18 | 19 | @property (weak, nonatomic) id delegate; 20 | 21 | @property (assign,nonatomic) NSInteger cellTag; 22 | 23 | -(instancetype)initWithFrame:(CGRect)frame withDictionary:(NSDictionary *)dict; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFScrollView/ZFTransformScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFTransformScrollView.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/13. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZFTransformScrollView : UIScrollView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFScrollView/ZFTransformScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZFTransformScrollView.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/13. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "ZFTransformScrollView.h" 10 | 11 | @implementation ZFTransformScrollView 12 | 13 | 14 | -(void)layoutSubviews{ 15 | 16 | [super layoutSubviews]; 17 | 18 | CGFloat contentOffsetX = self.contentOffset.x; 19 | 20 | for(UIView *view in self.subviews){ 21 | 22 | CATransform3D t1 = CATransform3DIdentity; 23 | view.layer.transform = t1; 24 | //计算每个cell的偏移量 25 | CGFloat distanceFromCenterX = view.frame.origin.x - contentOffsetX; 26 | 27 | CGFloat offsetRatio = distanceFromCenterX / CGRectGetWidth(self.frame); 28 | CGFloat angle = offsetRatio * 30; 29 | //前半部分 30 | if (offsetRatio < 0) { 31 | //offsetRation 为负 32 | //沿y轴向右转 沿着y的正方向看是逆时针 33 | CATransform3D t2 = CATransform3DMakeRotation(DEGREES_TO_RADIANS(-angle), 0, 1,0 ); 34 | //沿x轴向里转 沿着x的正方向看是逆时针 35 | CATransform3D t3 = CATransform3DRotate(t2, DEGREES_TO_RADIANS(-5 * offsetRatio) , 1, 0, 0); 36 | //沿y轴向下移动 距离正 37 | CATransform3D t4 = CATransform3DTranslate(t3, 0, -35 *offsetRatio, 0); 38 | //实现透视投影 默认是正交投影 以CGPointMake(0, 0)为观察点 3D效果更明显 39 | view.layer.transform = CATransform3DPerspect(t4, CGPointMake(0, 0), 500); 40 | } 41 | else{ 42 | //给个起始位置 在正常位置以下以左的某段距离 43 | t1 = CATransform3DMakeTranslation(60 * offsetRatio * 1.5, 100 * offsetRatio * 1.5, 0); 44 | //沿y轴向左转 沿着y的正方向看是顺时针 45 | CATransform3D t2 = CATransform3DRotate(t1,DEGREES_TO_RADIANS(-angle), 0, 1,0 ); 46 | //沿x轴向里转 沿着x的正方向看是逆时针 47 | CATransform3D t3 = CATransform3DRotate(t2, DEGREES_TO_RADIANS(5 * offsetRatio), 1, 0, 0); 48 | //沿y轴向上移动 距离正 49 | CATransform3D t4 = CATransform3DTranslate(t3, 0, -35 *offsetRatio, 0); 50 | //实现透视投影 默认是正交投影 以CGPointMake(0, 0)为观察点 3D效果更明显 51 | view.layer.transform = CATransform3DPerspect(t4, CGPointMake(0, 0), 500); 52 | } 53 | 54 | } 55 | } 56 | 57 | 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFSegmentedControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFSegmentedControl.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/3/18. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @protocol ZFSegmentedControlDelegate 13 | 14 | - (void)clickSegmentedControlAtIndex:(NSInteger)index; 15 | 16 | @end 17 | 18 | 19 | @interface ZFSegmentedControl : UIView 20 | 21 | @property (nonatomic,strong) UIColor *tintColor; 22 | 23 | @property (nonatomic,weak) id delegate; 24 | 25 | 26 | 27 | -(instancetype)initWithItems:(NSArray *)items; 28 | 29 | -(void)setNormalImage:(UIImage *)image forSegmentAtIndex:(NSInteger)index; 30 | 31 | -(void)setSelectedImage:(UIImage *)image forSegmentAtIndex:(NSInteger)index; 32 | 33 | -(void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /ZFCityGuides/ZFSliderAnimationView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFSliderAnimationView.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/3. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, ZFSliderStyle) { 12 | 13 | //一般类型 包括headTitle content footer detail 14 | ZFSliderStyleNormal, 15 | //可自定义的视图 16 | ZFSliderStyleView, 17 | //多个normal组成 18 | ZFSliderStyleMultiple, 19 | //多个customView组成 20 | ZFSliderStyleMultipleView, 21 | }; 22 | 23 | typedef NS_ENUM(NSInteger, ZFSliderItemAnimation) { 24 | 25 | ZFSliderItemAnimationLeft, 26 | ZFSliderItemAnimationRight, 27 | ZFSliderItemAnimationBoth 28 | 29 | }; 30 | 31 | 32 | typedef NS_OPTIONS(NSUInteger, ZFItemTypeOption) { 33 | ZFItemTypeOptionNone = 0, 34 | ZFItemTypeOptionNoHeader = 1 << 0, 35 | ZFItemTypeOptionNoFooter = 1 << 1, 36 | ZFItemTypeOptionNoTip = 1 << 2 37 | }; 38 | 39 | @interface ZFSliderAnimationItem : NSObject 40 | 41 | @property (nonatomic,strong) NSString *headerTitle; 42 | 43 | @property (nonatomic,strong) NSString *content; 44 | 45 | @property (nonatomic,strong) NSString *footerTitle; 46 | 47 | @property (nonatomic,strong) NSString *detailContent; 48 | 49 | @property (nonatomic,strong) UIColor *itemBackgroundColor; 50 | 51 | @property (nonatomic,assign) BOOL showDetail; 52 | 53 | @property (nonatomic,assign) BOOL showAnimated; 54 | 55 | 56 | @end 57 | 58 | @interface ZFSliderAnimationView : UIView 59 | 60 | 61 | @property (nonatomic,assign) ZFItemTypeOption itemType; 62 | 63 | @property (nonatomic,strong) UIColor *viewBackgroundColor; 64 | 65 | @property (nonatomic,assign) NSInteger viewTag; 66 | 67 | @property (nonatomic,assign) ZFSliderItemAnimation animation; 68 | 69 | @property (nonatomic,strong) UIView *customView; 70 | 71 | @property (nonatomic,strong) UILabel *contentLabel; 72 | 73 | @property (nonatomic,assign) ZFSliderStyle style; 74 | 75 | 76 | 77 | -(instancetype)initWithFrame:(CGRect)frame withStyle:(ZFSliderStyle)style customViews:(NSArray *)Views animationItems:(NSArray *)item; 78 | 79 | //animated:contentLabel 是否是动画 80 | -(void)updateAnimationView:(CGFloat)percent animated:(BOOL)animated; 81 | 82 | @end 83 | 84 | 85 | -------------------------------------------------------------------------------- /ZFCityGuides/font/FilmotypeGiant.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/font/FilmotypeGiant.otf -------------------------------------------------------------------------------- /ZFCityGuides/font/TrumpGothicEast-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/font/TrumpGothicEast-Bold.ttf -------------------------------------------------------------------------------- /ZFCityGuides/font/TrumpGothicEast.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/font/TrumpGothicEast.ttf -------------------------------------------------------------------------------- /ZFCityGuides/images/ZFCityGuides-stats.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/ZFCityGuides-stats.gif -------------------------------------------------------------------------------- /ZFCityGuides/images/about-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/about-icon.png -------------------------------------------------------------------------------- /ZFCityGuides/images/about-icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/about-icon@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/back@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/beijing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/beijing.jpg -------------------------------------------------------------------------------- /ZFCityGuides/images/card.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/card.jpg -------------------------------------------------------------------------------- /ZFCityGuides/images/essentials-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/essentials-icon.png -------------------------------------------------------------------------------- /ZFCityGuides/images/essentials-icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/essentials-icon@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/guangzhou.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/guangzhou.jpg -------------------------------------------------------------------------------- /ZFCityGuides/images/hongkong.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/hongkong.jpg -------------------------------------------------------------------------------- /ZFCityGuides/images/layout_grid@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/layout_grid@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/layout_slider@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/layout_slider@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/location.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/location.jpg -------------------------------------------------------------------------------- /ZFCityGuides/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/logo.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-dyk-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-dyk-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-dyk-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-dyk-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-dyk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-dyk.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-dyk@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-dyk@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-essentials-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-essentials-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-essentials-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-essentials-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-essentials.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-essentials.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-essentials@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-essentials@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-favorites-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-favorites-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-favorites-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-favorites-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-favorites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-favorites.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-favorites@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-favorites@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-food-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-food-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-food-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-food-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-food.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-food.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-food@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-food@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-itineraries-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-itineraries-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-itineraries-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-itineraries-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-itineraries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-itineraries.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-itineraries@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-itineraries@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-photos-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-photos-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-photos-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-photos-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-photos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-photos.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-photos@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-photos@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-search-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-search-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-search-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-search-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-search.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-search@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-search@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-secrets-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-secrets-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-secrets-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-secrets-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-secrets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-secrets.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-secrets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-secrets@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-settings-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-settings-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-settings-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-settings-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-settings.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-settings@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-settings@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-walks-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-walks-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-walks-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-walks-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-walks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-walks.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-walks@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-walks@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-weather-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-weather-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-weather-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-weather-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-weather.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-weather.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-weather@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-weather@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-wtd-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-wtd-selected.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-wtd-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-wtd-selected@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-wtd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-wtd.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-iphone-wtd@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-iphone-wtd@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-toggle-arrow-iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-toggle-arrow-iphone.png -------------------------------------------------------------------------------- /ZFCityGuides/images/main-menu-toggle-arrow-iphone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/main-menu-toggle-arrow-iphone@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/news-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/news-icon.png -------------------------------------------------------------------------------- /ZFCityGuides/images/news-icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/news-icon@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/photo.jpg -------------------------------------------------------------------------------- /ZFCityGuides/images/secret.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/secret.jpg -------------------------------------------------------------------------------- /ZFCityGuides/images/shanghai.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/shanghai.jpg -------------------------------------------------------------------------------- /ZFCityGuides/images/statistics-hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/statistics-hero.png -------------------------------------------------------------------------------- /ZFCityGuides/images/statistics-hero@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/statistics-hero@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/statistics-raindrop-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/statistics-raindrop-blue.png -------------------------------------------------------------------------------- /ZFCityGuides/images/statistics-raindrop-blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/statistics-raindrop-blue@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/statistics-raindrop-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/statistics-raindrop-yellow.png -------------------------------------------------------------------------------- /ZFCityGuides/images/statistics-raindrop-yellow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/statistics-raindrop-yellow@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/statistics-woman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/statistics-woman.png -------------------------------------------------------------------------------- /ZFCityGuides/images/statistics-woman@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/statistics-woman@2x.png -------------------------------------------------------------------------------- /ZFCityGuides/images/walk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WZF-Fei/ZFCityGuides/a87db422e4c7907ae0e4436f9479cdc09bf37c85/ZFCityGuides/images/walk.jpg -------------------------------------------------------------------------------- /ZFCityGuides/interactiveController/ZFInteractiveTransition.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFInteractiveTransition.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/18. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZFInteractiveTransition : UIPercentDrivenInteractiveTransition 12 | 13 | -(void)interactionForViewController:(UIViewController *)viewController; 14 | 15 | //用于判断交互手势是否进行中 16 | @property (nonatomic, assign) BOOL interactionInProgress; 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ZFCityGuides/interactiveController/ZFInteractiveTransition.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZFInteractiveTransition.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/18. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "ZFInteractiveTransition.h" 10 | 11 | @interface ZFInteractiveTransition () 12 | 13 | @property (strong, nonatomic) UIPanGestureRecognizer *panGesture; 14 | @property (strong, nonatomic) UIViewController *viewController; 15 | @property (assign, nonatomic) BOOL shouldCompleteTransition; 16 | 17 | @property (assign, nonatomic) CGFloat Speed; 18 | 19 | @end 20 | 21 | @implementation ZFInteractiveTransition 22 | 23 | -(void)dealloc { 24 | [_panGesture.view removeGestureRecognizer:_panGesture]; 25 | } 26 | 27 | -(void)interactionForViewController:(UIViewController *)viewController{ 28 | 29 | _viewController = viewController; 30 | // NSLog(@"viewcontroller:%@",_viewController); 31 | [self prepareGestureRecognizerInView:viewController.view]; 32 | } 33 | 34 | 35 | - (void)prepareGestureRecognizerInView:(UIView*)view { 36 | 37 | 38 | // NSLog(@"self frame:%@",NSStringFromCGRect(view.frame)); 39 | _panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)]; 40 | [view addGestureRecognizer:_panGesture]; 41 | 42 | } 43 | 44 | -(void)handleGesture:(UIPanGestureRecognizer *)recognizer{ 45 | 46 | self.Speed = 0; 47 | CGPoint translation = [recognizer translationInView:[_viewController.view superview]]; 48 | CGFloat beginY = 0; 49 | static CFTimeInterval beginTime = 0.0; 50 | 51 | 52 | switch (recognizer.state) { 53 | case UIGestureRecognizerStateBegan: 54 | 55 | beginY = translation.y; 56 | beginTime = CACurrentMediaTime(); 57 | 58 | if (translation.y >0) { 59 | self.interactionInProgress = YES; 60 | [_viewController dismissViewControllerAnimated:YES completion:nil]; 61 | 62 | } 63 | 64 | 65 | break; 66 | case UIGestureRecognizerStateChanged: 67 | if (self.interactionInProgress) { 68 | 69 | if (translation.y < 0) { 70 | return; 71 | } 72 | // 73 | CGFloat fraction = fabs(translation.y / [UIScreen mainScreen].bounds.size.height ); 74 | fraction = fminf(fmaxf(fraction, 0.0), 1.0); 75 | 76 | _shouldCompleteTransition = (fraction > 0.4); 77 | if (fraction >= 1.0) 78 | fraction = 0.99; 79 | 80 | [self updateInteractiveTransition:fraction]; 81 | 82 | // NSLog(@"translation point:%@ fraction:%f",NSStringFromCGPoint(translation),fraction); 83 | 84 | if (translation.y > 0) { 85 | [[NSNotificationCenter defaultCenter] postNotificationName:kChangedFrame object:@(translation.y)]; 86 | } 87 | 88 | } 89 | 90 | break; 91 | case UIGestureRecognizerStateEnded: 92 | case UIGestureRecognizerStateCancelled: 93 | 94 | 95 | if (self.interactionInProgress) { 96 | 97 | //计算时间 滑动的速率 98 | CFTimeInterval timeInterval = CACurrentMediaTime() - beginTime; 99 | CGFloat slipDistanceY = translation.y - beginY; 100 | 101 | self.Speed = slipDistanceY/ (timeInterval *1000); 102 | 103 | //当速率大于0.7(测试得到的结果) 响应dismiss方法 104 | if (self.Speed > 0.7) { 105 | self.interactionInProgress = YES; 106 | [_viewController dismissViewControllerAnimated:YES completion:nil]; 107 | [self finishInteractiveTransition]; 108 | return; 109 | } 110 | 111 | self.interactionInProgress = NO; 112 | if (!_shouldCompleteTransition || recognizer.state == UIGestureRecognizerStateCancelled) { 113 | [self cancelInteractiveTransition]; 114 | [[NSNotificationCenter defaultCenter] postNotificationName:kChangedFrame object:@(-1)]; 115 | } 116 | else { 117 | [self finishInteractiveTransition]; 118 | } 119 | } 120 | break; 121 | default: 122 | break; 123 | } 124 | 125 | } 126 | 127 | - (CGFloat)completionSpeed 128 | { 129 | return 1 - self.percentComplete; 130 | } 131 | @end 132 | -------------------------------------------------------------------------------- /ZFCityGuides/interactiveController/ZFNavInteractiveTransition.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFNavInteractiveTransition.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/2. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZFNavInteractiveTransition : UIPercentDrivenInteractiveTransition 12 | 13 | -(void)interactionForViewController:(UIViewController *)viewController; 14 | 15 | //用于判断交互手势是否进行中 16 | @property (nonatomic, assign) BOOL interactionInProgress; 17 | @property (nonatomic, assign) BOOL interactionOperationPop; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ZFCityGuides/interactiveController/ZFNavInteractiveTransition.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZFNavInteractiveTransition.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/2/2. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "ZFNavInteractiveTransition.h" 10 | 11 | @interface ZFNavInteractiveTransition () 12 | 13 | @property (strong, nonatomic) UIPanGestureRecognizer *panGesture; 14 | @property (strong, nonatomic) UIViewController *viewController; 15 | @property (assign, nonatomic) BOOL shouldCompleteTransition; 16 | 17 | @end 18 | 19 | @implementation ZFNavInteractiveTransition 20 | 21 | -(void)dealloc { 22 | [_panGesture.view removeGestureRecognizer:_panGesture]; 23 | } 24 | 25 | -(void)interactionForViewController:(UIViewController *)viewController{ 26 | 27 | _viewController = viewController; 28 | 29 | [self prepareGestureRecognizerInView:viewController.view]; 30 | } 31 | 32 | 33 | - (void)prepareGestureRecognizerInView:(UIView*)view { 34 | 35 | 36 | // NSLog(@"self frame:%@",NSStringFromCGRect(view.frame)); 37 | _panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)]; 38 | [view addGestureRecognizer:_panGesture]; 39 | 40 | } 41 | 42 | -(void)handleGesture:(UIPanGestureRecognizer *)recognizer{ 43 | 44 | CGPoint translation = [recognizer translationInView:[_viewController.view superview]]; 45 | 46 | switch (recognizer.state) { 47 | case UIGestureRecognizerStateBegan: 48 | 49 | if (translation.x >=0) { 50 | 51 | self.interactionInProgress = YES; 52 | [_viewController.navigationController popViewControllerAnimated:YES]; 53 | 54 | } 55 | 56 | 57 | break; 58 | case UIGestureRecognizerStateChanged: 59 | if (self.interactionInProgress) { 60 | 61 | if (translation.x < 0) { 62 | return; 63 | } 64 | // 65 | CGFloat fraction = fabs(translation.x / ([UIScreen mainScreen].bounds.size.width *0.7) ); 66 | fraction = fminf(fmaxf(fraction, 0.0), 1.0); 67 | 68 | _shouldCompleteTransition = (fraction > 0.4); 69 | if (fraction >= 1.0) 70 | fraction = 0.99; 71 | 72 | // NSLog(@"trasnlation:%@,fraction:%f",NSStringFromCGPoint(translation),fraction); 73 | [self updateInteractiveTransition:fraction]; 74 | 75 | 76 | } 77 | 78 | break; 79 | case UIGestureRecognizerStateEnded: 80 | case UIGestureRecognizerStateCancelled: 81 | 82 | 83 | if (self.interactionInProgress) { 84 | 85 | self.interactionInProgress = NO; 86 | if (!_shouldCompleteTransition || recognizer.state == UIGestureRecognizerStateCancelled) { 87 | [self cancelInteractiveTransition]; 88 | } 89 | else { 90 | [self finishInteractiveTransition]; 91 | } 92 | } 93 | break; 94 | default: 95 | break; 96 | } 97 | 98 | } 99 | 100 | 101 | - (CGFloat)completionSpeed 102 | { 103 | return 1 - self.percentComplete; 104 | } 105 | 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /ZFCityGuides/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/11. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ZFCityGuides/tabBarContoller/TabBarItemCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TabBarItemCell.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/21. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TabBarItemCell : UICollectionViewCell 12 | 13 | @property (strong, nonatomic) UIImageView *itemImageView; 14 | 15 | @property (strong, nonatomic) UILabel *itemNameLabel; 16 | 17 | @property (assign, nonatomic) BOOL isSelected; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ZFCityGuides/tabBarContoller/TabBarItemCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // TabBarItemCell.m 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/21. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "TabBarItemCell.h" 10 | 11 | @implementation TabBarItemCell 12 | 13 | -(id)initWithFrame:(CGRect)frame{ 14 | 15 | self = [super initWithFrame:frame]; 16 | 17 | if (self) { 18 | 19 | [self initSubViews]; 20 | } 21 | 22 | return self; 23 | } 24 | 25 | -(void)initSubViews{ 26 | CGSize size = self.itemImageView.image.size; 27 | 28 | self.itemImageView.frame = CGRectMake((self.frame.size.width - size.width)/2, (self.frame.size.height *0.5)/2, size.width, size.height); 29 | [self addSubview:self.itemImageView]; 30 | 31 | self.itemNameLabel.frame = CGRectMake(0, CGRectGetMaxY(self.itemImageView.frame) +5 , self.frame.size.width, 30); 32 | self.itemNameLabel.font = [UIFont boldSystemFontOfSize:9.0f]; 33 | self.itemNameLabel.textAlignment = NSTextAlignmentCenter; 34 | self.itemNameLabel.textColor = kTabItemTextNormal; 35 | [self addSubview:self.itemNameLabel]; 36 | 37 | 38 | } 39 | -(void)layoutSubviews{ 40 | 41 | [super layoutSubviews]; 42 | 43 | [self initSubViews]; 44 | } 45 | 46 | #pragma mark -setter 47 | 48 | -(UIImageView *)itemImageView{ 49 | 50 | if (!_itemImageView) { 51 | 52 | _itemImageView = [UIImageView new]; 53 | } 54 | 55 | return _itemImageView; 56 | } 57 | 58 | -(UILabel *)itemNameLabel{ 59 | 60 | if (!_itemNameLabel) { 61 | 62 | _itemNameLabel = [UILabel new]; 63 | } 64 | 65 | return _itemNameLabel; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /ZFCityGuides/tabBarContoller/ZFMainTabBarController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFMainTabBarController.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/20. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZFMainTabBarController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZFCityGuides/viewControllers/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/28. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | typedef enum 13 | { 14 | NavigationStyleNone, 15 | NavigationStyleLeft, 16 | NavigationStyleLeftAndMid, 17 | NavigationStyleLeftAndRight, 18 | NavigationStyleMidAndRight, 19 | NavigationStyleAll 20 | 21 | } NavigationStyle; 22 | 23 | 24 | @interface BaseViewController : UIViewController 25 | 26 | @property (nonatomic,strong) NSString *navigationTitle; 27 | @property (nonatomic,strong) UIImage *leftItemImage; 28 | @property (nonatomic,strong) UIImage *midItemImage; 29 | @property (nonatomic,strong) UIImage *rightItemImage; 30 | 31 | @property (nonatomic,strong) UIColor *navigationTintColor; 32 | 33 | @property (nonatomic,strong) UIView *navigationBarView; 34 | 35 | 36 | - (void) createNavigationBarWithStyle:(NavigationStyle)navigationStyle 37 | leftImage:(UIImage *)leftImage 38 | midImage:(UIImage *)midImage 39 | rightImage:(UIImage *)rightImage; 40 | 41 | 42 | -(void)pushNextViewController:(UIViewController *)viewController animated:(BOOL)animated; 43 | @end 44 | -------------------------------------------------------------------------------- /ZFCityGuides/viewControllers/EssentialsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // EssentialsViewController.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/28. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface EssentialsViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZFCityGuides/viewControllers/MainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/11. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MainViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ZFCityGuides/viewControllers/StatsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // StatsViewController.h 3 | // ZFCityGuides 4 | // 5 | // Created by macOne on 16/1/15. 6 | // Copyright © 2016年 WZF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface StatsViewController : BaseViewController 12 | 13 | @end 14 | --------------------------------------------------------------------------------