Repository: lkzhao/YetAnotherAnimationLibrary Branch: master Commit: 4d61028ce6aa Files: 51 Total size: 148.2 KB Directory structure: gitextract_y63l8lpk/ ├── .gitignore ├── .swift-version ├── .swiftlint.yml ├── Examples/ │ ├── CardViewController.swift │ ├── GestureViewController.swift │ └── Supporting Files/ │ ├── AppDelegate.swift │ ├── Assets.xcassets/ │ │ └── AppIcon.appiconset/ │ │ └── Contents.json │ ├── Base.lproj/ │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ └── Info.plist ├── LICENSE ├── Package.swift ├── README.md ├── Sources/ │ └── YetAnotherAnimationLibrary/ │ ├── Animatables/ │ │ ├── Animatable.swift │ │ ├── CurveAnimatable.swift │ │ ├── DecayAnimatable.swift │ │ ├── SolverAnimatable.swift │ │ └── SpringAnimatable.swift │ ├── AnimationProperty/ │ │ ├── AnimationProperty.swift │ │ └── Announcer.swift │ ├── Animations/ │ │ ├── Animation.swift │ │ ├── CurveAnimation.swift │ │ ├── DecayAnimation.swift │ │ ├── MixAnimation.swift │ │ ├── SolvableAnimation.swift │ │ ├── SpringAnimation.swift │ │ └── ValueAnimation.swift │ ├── Animator/ │ │ ├── Animator.swift │ │ └── DisplayLink.swift │ ├── Extensions/ │ │ ├── CALayer+YAAL.swift │ │ ├── NSObject+YAAL.swift │ │ ├── UILabel+YAAL.swift │ │ ├── UIScrollView+YAAL.swift │ │ └── UIView+YAAL.swift │ ├── Info.plist │ ├── Solvers/ │ │ ├── Curve.swift │ │ ├── CurveSolver.swift │ │ ├── DecaySolver.swift │ │ ├── RK4Solver.swift │ │ ├── Solver.swift │ │ ├── SpringSolver.swift │ │ └── VelocitySmoother.swift │ ├── Types & Operators/ │ │ ├── ChainOperator.swift │ │ ├── Vector.swift │ │ └── VectorConvertible.swift │ └── YaalCompatible.swift ├── YetAnotherAnimationLibrary.podspec └── YetAnotherAnimationLibrary.xcodeproj/ ├── project.pbxproj ├── project.xcworkspace/ │ ├── contents.xcworkspacedata │ └── xcshareddata/ │ └── IDEWorkspaceChecks.plist └── xcshareddata/ └── xcschemes/ └── YetAnotherAnimationLibrary.xcscheme ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .DS_Store # Xcode # # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore ## Build generated build/ DerivedData/ ## Various settings *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata/ ## Other *.moved-aside *.xcuserstate ## Obj-C/Swift specific *.hmap *.ipa *.dSYM.zip *.dSYM ## Playgrounds timeline.xctimeline playground.xcworkspace # Swift Package Manager # # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. # Packages/ .build/ # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # # Pods/ # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. # Carthage/Checkouts Carthage/Build # fastlane # # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the # screenshots whenever they are needed. # For more information about the recommended setup visit: # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md fastlane/report.xml fastlane/Preview.html fastlane/screenshots fastlane/test_output ================================================ FILE: .swift-version ================================================ 4.2 ================================================ FILE: .swiftlint.yml ================================================ disabled_rules: # rule identifiers to exclude from running - missing_docs - shorthand_operator - vertical_parameter_alignment - opening_brace - variable_name opt_in_rules: # some rules are only opt-in - empty_count # Find all the available rules by running: # swiftlint rules included: # paths to include during linting. `--path` is ignored if present. - Sources excluded: # paths to ignore during linting. Takes precedence over `included`. - Carthage - Pods # configurable rules can be customized from this configuration file # binary rules can set their severity level force_cast: warning # implicitly force_try: severity: warning # explicitly # rules that have both warning and error levels, can set just the warning level # implicitly line_length: 130 # they can set both implicitly with an array type_body_length: - 100 # warning - 150 # error # or they can set both explicitly file_length: warning: 200 error: 500 # naming rules can set warnings/errors for min_length and max_length # additionally they can set excluded names type_name: min_length: 3 # only warning max_length: # warning and error warning: 40 error: 50 excluded: # excluded via string - T - t variable_name: min_length: # only min_length error: 3 # only error excluded: # excluded via string array - id - vc - to - a - b - t - x - y - z - w - p - xy - dx - dy - dt - dv - gr - ax - ay - bx - by - cx - cy ================================================ FILE: Examples/CardViewController.swift ================================================ import UIKit import YetAnotherAnimationLibrary class CardViewController: UIViewController { let gr = UIPanGestureRecognizer() var card: UIView! var backCard: UIView? func generateCard() -> UIView { let frame = view.bounds.inset(by: UIEdgeInsets(top:120, left: 50, bottom: 120, right: 50)) let card = UIView(frame: frame) card.layer.cornerRadius = 7 card.backgroundColor = .white view.insertSubview(card, at: 0) card.yaal.center.value => { [weak view] newCenter in if let view = view { return (newCenter.x - view.center.x) / view.bounds.width } return nil } => card.yaal.rotation card.yaal.scale.value => { $0 * $0 } => card.yaal.alpha return card } override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = UIColor(red: 1.0, green: 0.5, blue: 0.5, alpha: 1.0) gr.addTarget(self, action: #selector(pan(gr:))) view.addGestureRecognizer(gr) card = generateCard() } @objc func pan(gr: UIPanGestureRecognizer) { let translation = gr.translation(in: view) switch gr.state { case .began: backCard = generateCard() backCard!.yaal.scale.setTo(0.7) fallthrough case .changed: card.yaal.center.setTo(CGPoint(x:translation.x + view.center.x, y:translation.y / 10 + view.center.y)) backCard!.yaal.scale.setTo(abs(translation.x)/view.bounds.width * 0.3 + 0.7) default: if let backCard = backCard, abs(translation.x) > view.bounds.width / 4 { let finalX = translation.x < 0 ? -view.bounds.width : view.bounds.width*2 card.yaal.center.animateTo(CGPoint(x:finalX, y:view.center.y)) { [card] _ in card?.removeFromSuperview() } card = backCard card.yaal.scale.animateTo(1) } else { backCard?.yaal.scale.animateTo(0) { [backCard] _ in backCard?.removeFromSuperview() } card.yaal.center.animateTo(view.center) } backCard = nil } } } ================================================ FILE: Examples/GestureViewController.swift ================================================ import UIKit import YetAnotherAnimationLibrary extension CGPoint { var magnitude: CGFloat { return hypot(x, y) } } func + (l: CGPoint, r: CGPoint) -> CGPoint { return CGPoint(x: l.x + r.x, y: l.y + r.y) } extension CGFloat { func clamp(_ a: CGFloat, b: CGFloat) -> CGFloat { return CGFloat.minimum(CGFloat.maximum(self, a), b) } } class GestureViewController: UIViewController { let red = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) override func viewDidLoad() { super.viewDidLoad() red.center = view.center red.layer.cornerRadius = 7 red.backgroundColor = UIColor(red: 1.0, green: 0.5, blue: 0.5, alpha: 1.0) view.addSubview(red) view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tap(gr:)))) red.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(pan(gr:)))) red.layer.yaal.perspective.setTo(-1/500) let limit = CGFloat.pi / 3 red.yaal.center.velocity => { 1 - $0.magnitude / 3000 } => red.yaal.alpha // 2d rotation red.yaal.center.velocity => { ($0.x / 1000).clamp(-limit, b: limit) } => red.yaal.rotation // 3d rotation red.yaal.center.velocity => { ($0.x / 1000).clamp(-limit, b: limit) } => red.yaal.rotationY red.yaal.center.velocity => { (-$0.y / 1000).clamp(-limit, b: limit) } => red.yaal.rotationX } @objc func tap(gr: UITapGestureRecognizer) { red.yaal.center.animateTo(gr.location(in: view)) } var beginPosition: CGPoint? @objc func pan(gr: UIPanGestureRecognizer) { switch gr.state { case .began: beginPosition = red.center fallthrough case .changed: red.yaal.center.setTo(gr.translation(in: view) + beginPosition!) default: red.yaal.center.decay(initialVelocity:gr.velocity(in: nil), damping: 5) } } } ================================================ FILE: Examples/Supporting Files/AppDelegate.swift ================================================ import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. UINavigationBar.appearance().tintColor = UIColor(red: 1.0, green: 0.4, blue: 0.4, alpha: 1.0) return true } func applicationWillResignActive(_ application: UIApplication) { // 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. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // 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. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // 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. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } } ================================================ FILE: Examples/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "1x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "2x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "1x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "2x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "1x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Examples/Supporting Files/Base.lproj/LaunchScreen.storyboard ================================================ ================================================ FILE: Examples/Supporting Files/Base.lproj/Main.storyboard ================================================ ================================================ FILE: Examples/Supporting Files/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Luke Zhao Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Package.swift ================================================ // swift-tools-version:5.2 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "YetAnotherAnimationLibrary", platforms: [.iOS(.v9)], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "YetAnotherAnimationLibrary", targets: ["YetAnotherAnimationLibrary"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "YetAnotherAnimationLibrary", dependencies: []), ] ) ================================================ FILE: README.md ================================================ # Yet Another Animation Library Designed for gesture-driven animations. Fast, simple, & extensible! It is written in pure swift 3.1 with protocol oriented design and extensive use of generics. Consider this as a swift optimized version of facebook's pop. It plays nicer with swift and faster too. **Fast**: * Uses SIMD types and instructions for calculation * Better compiler optimization through swift generics **Simple**: * Supports Curve(Basic), Spring, & Decay animations out of the box * Easy API for animating common animatable properties. (checkout the [Extensions](https://github.com/lkzhao/YetAnotherAnimationLibrary/tree/master/Sources/Extensions) folder for list of included properties) * Type safety guaranteed when assigning animation values * Observable, including value, velocity, and target value * Builtin chaining operator to easily react to changes in value * Provide velocity interpolation with gestures **Extensible**: * Supports custom property * Supports custom animatable type * Supports custom animation ## Installation ```ruby pod "YetAnotherAnimationLibrary" ``` ## Usage ### Animation ```swift // Spring animation view.yaal.center.animateTo(CGPoint(x:50, y:100)) view.yaal.alpha.animateTo(0.5, stiffness: 300, damping: 20) // Curve(Basic) animation view.yaal.frame.animateTo(CGRect(x:0, y:0, width:50, height:50), duration:0.5, curve: .linear) // Decay Animation view.yaal.center.decay(initialVelocity:CGPoint(x:100, y:0)) ``` ### Observe Changes ```swift // observe value changes view.yaal.center.value.changes.addListener { oldVelocity, newVelocity in print(oldVelocity, newVelocity) } // observe velocity changes view.yaal.center.velocity.changes.addListener { oldVelocity, newVelocity in print(oldVelocity, newVelocity) } ``` ### Chaining Reactions ```swift // when scale changes, also change its alpha // for example if view's scale animates from 1 to 0.5. its alpha will animate to 0.5 as well view.yaal.scale.value => view.yaal.alpha // equvalent to the following // view.yaal.scale.value.changes.addListener { _, newScale in // view.yaal.alpha.animateTo(newScale) // } // optionally you can provide a mapping function in between. // For example, the following code makes the view more transparent the faster it is moving view.yaal.center.velocity => { 1 - $0.magnitude / 1000 } => view.yaal.alpha // equvalent to the following // view.yaal.center.velocity.changes.addListener { _, newVelocity in // view.yaal.alpha.animateTo(1 - newVelocity.magnitude / 1000) // } ``` ### Set Value (Notify listeners) ```swift // this sets the value directly (not animate to). Change listeners are called. // Velocity listeners will receive a series of smoothed velocity values. view.yaal.center.setTo(gestureRecognizer.location(in:nil)) ``` ## Advance Usages ### React to changes Animate is very efficient at observing animated value and react accordingly. Some awesome effects can be achieved through observed values. For example, here is a simple 2d rotation animation thats made possible through observing the center value's velocity. ```swift override func viewDidLoad() { // ... view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tap(gr:)))) squareView.yaal.center.velocity => { $0.x / 1000 } => squareView.yaal.rotation } func tap(gr: UITapGestureRecognizer) { squareView.yaal.center.animateTo(gr.location(in: view)) } ``` ---------------------- Animate also provide smooth velocity interpolation when calling `setTo(_:)`. This is especially useful when dealing with user gesture. For example. the following does a 3d rotate animation when dragged ```swift override func viewDidLoad() { // ... squareView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(pan(gr:)))) squareView.yaal.perspective.setTo(-1.0 / 500.0) squareView.yaal.center.velocity => { $0.x / 1000 } => squareView.yaal.rotationY squareView.yaal.center.velocity => { -$0.y / 1000 } => squareView.yaal.rotationX } func pan(gr: UIPanGestureRecognizer) { squareView.yaal.center.setTo(gr.location(in: view)) } ``` ### Custom property To animate custom property, just create an animation object by calling `SpringAnimation(getter:setter:)`. Use the animation object to animate and set the values. There are 4 types of animations provided by Animate: * SpringAnimation * CurveAnimation * DecayAnimation * MixAnimation (does all three types of animation) ```swift class Foo { var volumn: Float = 0.0 lazy var volumnAnimation: SpringAnimation = SpringAnimation(getter: { [weak self] in self?.volumn }, setter: { [weak self] in self?.volumn = $0 }) } volumnAnimation.animateTo(0.5) ``` If your class inherits from NSObject, then it is even easier by using the built in animation store. ### via extension & `yaal.animationFor` ```swift extension Foo { public var volumnAnimation: MixAnimation { return yaal.animationFor(key: "volumn", getter: { [weak self] in self?.volumn }, setter: { [weak self] in self?.volumn = $0 }) } } ``` ### via `yaal.register` & `yaal.animationFor` ```swift // or register ahead of time yaal.register(key: "volumn", getter: { [weak self] in self?.volumn }, setter: { [weak self] in self?.volumn = $0 }) // and retrieve the animation object through the same key. yaal.animationFor(key: "volumn")!.animateTo(0.5) // NOTE: that this method have limited type safety. You can basically pass any animatable type into `animateTo()` // There is nothing to stop you from doing the following. but they will crash at run time yaal.animationFor(key: "volumn")!.animateTo(CGSize.zero) yaal.animationFor(key: "volumn")!.animateTo(CGRect.zero) ``` ### Custom Animatable Type Custom animatable types are also supported. Just make the type conform to `VectorConvertable`. ```swift // the following makes IndexPath animatable extension IndexPath: VectorConvertible { public typealias Vector = Vector2 public init(vector: Vector) { self.init(item: Int(vector.x), section: Int(vector.y)) } public var vector: Vector { return [Double(item), Double(section)] } } // Can now be used like this let indexAnimation = SpringAnimation(getter: { self.indexPath }, setter: { self.indexPath = $0 }) indexAnimation.animateTo(IndexPath(item:0, section:0)) // Note that everything is type safe. incorrect type won't be allowed to compile ``` ### Custom Animation Just subclass `Animation` and override `update(dt:TimeInterval)` method. If your animation need getter & setter support, subclass `ValueAnimation` instead. Checkout the builtin animations for example. ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animatables/Animatable.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public protocol Animatable: AnyObject { func update(dt: TimeInterval) func start(_ completionHandler: ((Bool) -> Void)?) func finish() } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animatables/CurveAnimatable.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public protocol CurveAnimatable: SolverAnimatable { var defaultCurve: Curve { get set } var target: AnimationProperty { get } } extension CurveAnimatable { public func setDefaultCurve(_ curve: Curve) { defaultCurve = curve } public func animateTo(_ targetValue: Value, duration: TimeInterval, curve: Curve? = nil, completionHandler: ((Bool) -> Void)? = nil) { target.value = targetValue solver = CurveSolver(duration: duration, curve: curve ?? defaultCurve, current: value, target: target, velocity: velocity) start(completionHandler) } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animatables/DecayAnimatable.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public protocol DecayAnimatable: SolverAnimatable { var defaultThreshold: Double { get set } var defaultDamping: Double { get set } } extension DecayAnimatable { public func setDefaultDamping(_ damping: Double) { defaultDamping = damping } public func setDefaultThreshold(_ threshold: Double) { defaultThreshold = threshold } public func decay(initialVelocity: Value? = nil, damping: Double? = nil, threshold: Double? = nil, completionHandler: ((Bool) -> Void)? = nil) { if let initialVelocity = initialVelocity { velocity.value = initialVelocity } var solver = DecaySolver(damping: damping ?? defaultDamping, threshold: threshold ?? defaultThreshold) solver.current = value solver.velocity = velocity self.solver = solver start(completionHandler) } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animatables/SolverAnimatable.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public protocol SolverAnimatable: Animatable { associatedtype Value: VectorConvertible var solver: Solver? { get set } var value: AnimationProperty { get } var velocity: AnimationProperty { get } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animatables/SpringAnimatable.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public protocol SpringAnimatable: DecayAnimatable { var defaultStiffness: Double { get set } var target: AnimationProperty { get } } // convenience extension SpringAnimatable { public func setDefaultStiffness(_ stiffness: Double) { defaultStiffness = stiffness } public func animateTo(_ targetValue: Value, initialVelocity: Value? = nil, stiffness: Double? = nil, damping: Double? = nil, threshold: Double? = nil, completionHandler: ((Bool) -> Void)? = nil) { target.value = targetValue if let initialVelocity = initialVelocity { velocity.value = initialVelocity } var solver = SpringSolver(stiffness: stiffness ?? defaultStiffness, damping: damping ?? defaultDamping, threshold: threshold ?? defaultThreshold) solver.current = value solver.velocity = velocity solver.target = target self.solver = solver start(completionHandler) } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/AnimationProperty/AnimationProperty.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public class AnimationProperty { private var _changes: Announcer? public var changes: Announcer { if _changes == nil { _changes = Announcer() } return _changes! } public var vector: Value.Vector = Value.Vector() { didSet { if let announcer = _changes { announcer.notify(old: oldValue, new: vector) } } } public var value: Value { get { return Value.from(vector: vector) } set { vector = newValue.vector } } public init() {} public init(value: Value) { self.value = value } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/AnimationProperty/Announcer.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public class Announcer { public typealias Vector = Value.Vector public var listeners = [String: (Value, Value) -> Void]() public var vectorListeners = [String: (Vector, Vector) -> Void]() public var hasListener: Bool { return !listeners.isEmpty } public var hasVectorListener: Bool { return !vectorListeners.isEmpty } public func addListener(_ listener:@escaping (_ old: Value, _ new: Value) -> Void) { listeners[UUID().uuidString] = listener } public func addListenerWith(identifier: String, listener:@escaping (_ old: Value, _ new: Value) -> Void) { listeners[identifier] = listener } public func removeListenerWith(identifier: String) { listeners[identifier] = nil } public func removeAllListeners() { listeners.removeAll() } public func addVectorListener(_ listener:@escaping (_ old: Vector, _ new: Vector) -> Void) { vectorListeners[UUID().uuidString] = listener } public func addVectorListenerWith(identifier: String, listener:@escaping (_ old: Vector, _ new: Vector) -> Void) { vectorListeners[identifier] = listener } public func removeVectorListenerWith(identifier: String) { vectorListeners[identifier] = nil } public func removeAllVectorListeners() { vectorListeners.removeAll() } public func notify(old: Vector, new: Vector) { for listener in vectorListeners.values { listener(old, new) } if !listeners.isEmpty { let old = Value.from(vector: old) let new = Value.from(vector: new) for listener in listeners.values { listener(old, new) } } } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animations/Animation.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation /// Base animation class /// Provides start/finish/cancel/stop functions to an animation /// open class Animation: NSObject, Animatable { public private(set) var isRunning: Bool = false public private(set) var completionHandler: ((Bool) -> Void)? public func start(_ completionHandler: ((Bool) -> Void)? = nil) { if let oldCompletion = self.completionHandler { oldCompletion(false) self.completionHandler = completionHandler } self.completionHandler = completionHandler if isRunning { return } isRunning = true willStart() Animator.shared.add(animation: self) } public func finish() { if !isRunning { return } isRunning = false Animator.shared.remove(animation: self) didEnd(finished: true) } public func cancel() { if !isRunning { return } isRunning = false Animator.shared.remove(animation: self) didEnd(finished: false) } public func stop() { cancel() } // override point for subclass open func willUpdate() { } open func update(dt: TimeInterval) { } open func didUpdate() { } open func willStart() { } open func didEnd(finished: Bool) { completionHandler?(finished) completionHandler = nil } // called by animator internal final func displayTick(dt: TimeInterval) { willUpdate() update(dt: dt) didUpdate() } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animations/CurveAnimation.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public class CurveAnimation: SolvableAnimation, CurveAnimatable { public var defaultCurve: Curve = .linear public let target = AnimationProperty() } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animations/DecayAnimation.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public class DecayAnimation: SolvableAnimation, DecayAnimatable { public var defaultThreshold: Double = 0.001 public var defaultDamping: Double = 20 } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animations/MixAnimation.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation open class MixAnimation: SolvableAnimation, SpringAnimatable, CurveAnimatable, DecayAnimatable { public var defaultThreshold: Double = 0.001 public var defaultStiffness: Double = 150 public var defaultDamping: Double = 20 public var defaultCurve: Curve = .linear public let target = AnimationProperty() } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animations/SolvableAnimation.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation open class SolvableAnimation: ValueAnimation, SolverAnimatable { public var solver: Solver? public let velocity = AnimationProperty() open override func update(dt: TimeInterval) { if solver?.solve(dt: dt) != false { finish() } } open override func didEnd(finished: Bool) { super.didEnd(finished: finished) velocity.vector = Value.Vector() solver = nil } open override func setTo(_ value: Value) { updateWithCurrentState() if solver as? VelocitySmoother == nil { solver = VelocitySmoother(value: self.value, velocity: velocity) } super.setTo(value) start() } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animations/SpringAnimation.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public class SpringAnimation: DecayAnimation, SpringAnimatable { public var defaultStiffness: Double = 150 public let target = AnimationProperty() } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animations/ValueAnimation.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation open class ValueAnimation: Animation { typealias Vector = Value.Vector // getter returns optional because we dont want strong references inside the getter block public var getter: () -> Value? public var setter: (Value) -> Void public let value: AnimationProperty open override func willStart() { super.willStart() updateWithCurrentState() } open override func didUpdate() { super.didUpdate() setter(value.value) } public init(getter:@escaping () -> Value?, setter:@escaping (Value) -> Void) { self.value = AnimationProperty() self.getter = getter self.setter = setter } public init(value: AnimationProperty) { self.value = value self.getter = { return nil } self.setter = { newValue in } } public convenience override init() { self.init(value: AnimationProperty()) } public func setTo(_ value: Value) { self.value.value = value setter(value) } public func updateWithCurrentState() { if let currentValue = getter() { value.value = currentValue } } public func from(_ value: Value) -> Self { self.value.value = value setter(value) return self } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animator/Animator.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation internal class Animator: DisplayLink { static let shared = Animator() private var animations = Set() override func update(dt: TimeInterval) { for animation in animations { animation.displayTick(dt: dt) } } func has(animation: Animation) -> Bool { return animations.contains(animation) } func add(animation: Animation) { animations.insert(animation) start() } func remove(animation: Animation) { animations.remove(animation) if animations.isEmpty { stop() } } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Animator/DisplayLink.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import UIKit private let minDeltaTime = 1.0 / 30.0 /// The `update(dt:)` function will be called on every screen refresh if started internal class DisplayLink: NSObject { private var displayLink: CADisplayLink? private var lastUpdateTime: TimeInterval = 0 internal var isRunning: Bool { return displayLink != nil } @objc internal func _update() { guard let _ = displayLink else { return } let currentTime = CACurrentMediaTime() defer { lastUpdateTime = currentTime } var dt = currentTime - lastUpdateTime while dt > minDeltaTime { update(dt: minDeltaTime) dt -= minDeltaTime } update(dt: dt) } open func update(dt: TimeInterval) {} internal func start() { guard !isRunning else { return } lastUpdateTime = CACurrentMediaTime() displayLink = CADisplayLink(target: self, selector: #selector(_update)) if #available(iOS 15.0, *) { displayLink?.preferredFrameRateRange = CAFrameRateRange(minimum:80, maximum:120, preferred:120) } displayLink!.add(to: .main, forMode: .common) } internal func stop() { guard let displayLink = displayLink else { return } displayLink.isPaused = true displayLink.remove(from: .main, forMode: .common) self.displayLink = nil } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Extensions/CALayer+YAAL.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import UIKit extension Yaal where Base: CALayer { public var position: MixAnimation { return animationFor(key: "position", getter: { [weak base] in base?.position }, setter: { [weak base] in base?.position = $0 }) } public var opacity: MixAnimation { return animationFor(key: "opacity", getter: { [weak base] in base?.opacity }, setter: { [weak base] in base?.opacity = $0 }) } public var bounds: MixAnimation { return animationFor(key: "bounds", getter: { [weak base] in base?.bounds }, setter: { [weak base] in base?.bounds = $0 }) } public var frame: MixAnimation { return animationFor(key: "frame", getter: { [weak base] in base?.frame }, setter: { [weak base] in base?.frame = $0 }) } public var backgroundColor: MixAnimation { return animationFor(key: "backgroundColor", getter: { [weak base] in base?.backgroundColor }, setter: { [weak base] in base?.backgroundColor = $0 }) } public var cornerRadius: MixAnimation { return animationFor(key: "cornerRadius", getter: { [weak base] in base?.cornerRadius }, setter: { [weak base] in base?.cornerRadius = $0 }) } public var zPosition: MixAnimation { return animationFor(key: "zPosition", getter: { [weak base] in base?.zPosition }, setter: { [weak base] in base?.zPosition = $0 }) } public var borderWidth: MixAnimation { return animationFor(key: "borderWidth", getter: { [weak base] in base?.borderWidth }, setter: { [weak base] in base?.borderWidth = $0 }) } public var borderColor: MixAnimation { return animationFor(key: "borderColor", getter: { [weak base] in base?.borderColor }, setter: { [weak base] in base?.borderColor = $0 }) } public var shadowRadius: MixAnimation { return animationFor(key: "shadowRadius", getter: { [weak base] in base?.shadowRadius }, setter: { [weak base] in base?.shadowRadius = $0 }) } public var shadowColor: MixAnimation { return animationFor(key: "shadowColor", getter: { [weak base] in base?.shadowColor }, setter: { [weak base] in base?.shadowColor = $0 }) } public var shadowOffset: MixAnimation { return animationFor(key: "shadowOffset", getter: { [weak base] in base?.shadowOffset }, setter: { [weak base] in base?.shadowOffset = $0 }) } public var shadowOpacity: MixAnimation { return animationFor(key: "shadowOpacity", getter: { [weak base] in base?.shadowOpacity }, setter: { [weak base] in base?.shadowOpacity = $0 }) } public var perspective: MixAnimation { return animationFor(key: "perspective", getter: { [weak base] in base?.transform.m34 }, setter: { [weak base] in base?.transform.m34 = $0 }) } public var translation: MixAnimation { return animationForKeyPath("transform.translation") } public var translationX: MixAnimation { return animationForKeyPath("transform.translation.x") } public var translationY: MixAnimation { return animationForKeyPath("transform.translation.y") } public var translationZ: MixAnimation { return animationForKeyPath("transform.translation.z") } public var scale: MixAnimation { return animationForKeyPath("transform.scale") } public var scaleX: MixAnimation { return animationForKeyPath("transform.scale.x") } public var scaleY: MixAnimation { return animationForKeyPath("transform.scale.y") } public var rotation: MixAnimation { return animationForKeyPath("transform.rotation") } public var rotationX: MixAnimation { return animationForKeyPath("transform.rotation.x") } public var rotationY: MixAnimation { return animationForKeyPath("transform.rotation.y") } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Extensions/NSObject+YAAL.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation extension NSObject { internal class YaalState { internal init() {} internal var animations: [String: Any] = [:] } internal var yaalState: YaalState { struct AssociatedKeys { internal static var yaalState = "yaalState" } if let state = objc_getAssociatedObject(self, &AssociatedKeys.yaalState) as? YaalState { return state } else { let state = YaalState() objc_setAssociatedObject(self, &AssociatedKeys.yaalState, state, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) return state } } } extension Yaal where Base: NSObject { public func animationFor(key: String, getter: @escaping () -> Value?, setter: @escaping (Value) -> Void) -> MixAnimation { if let anim = base.yaalState.animations[key] as? MixAnimation { return anim } else { let anim = MixAnimation(getter: getter, setter: setter) base.yaalState.animations[key] = anim return anim } } @discardableResult public func register(key: String, getter: @escaping () -> Value?, setter: @escaping (Value) -> Void) -> MixAnimation { return animationFor(key: key, getter: getter, setter: setter) } public func animationFor(key: String) -> MixAnimation? { return base.yaalState.animations[key] as? MixAnimation } public func animationForKeyPath(_ keyPath: String) -> MixAnimation { return animationFor(key: keyPath, getter: { [weak base] in base?.value(forKeyPath: keyPath) as? Value }, setter: { [weak base] in base?.setValue($0, forKeyPath: keyPath) }) } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Extensions/UILabel+YAAL.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import UIKit extension Yaal where Base: UILabel { public var textColor: MixAnimation { return animationFor(key: "textColor", getter: { [weak base] in base?.textColor }, setter: { [weak base] in base?.textColor = $0 }) } public var shadowColor: MixAnimation { return animationFor(key: "shadowColor", getter: { [weak base] in base?.shadowColor }, setter: { [weak base] in base?.shadowColor = $0 }) } public var shadowOffset: MixAnimation { return animationFor(key: "shadowOffset", getter: { [weak base] in base?.shadowOffset }, setter: { [weak base] in base?.shadowOffset = $0 }) } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Extensions/UIScrollView+YAAL.swift ================================================ // // UIScrollView+YAAL.swift // YetAnotherAnimationLibrary // // Created by Luke on 4/13/17. // Copyright © 2017 Luke Zhao. All rights reserved. // import UIKit extension Yaal where Base: UIScrollView { public var contentOffset: MixAnimation { return animationFor(key: "contentOffset", getter: { [weak base] in base?.contentOffset }, setter: { [weak base] in base?.contentOffset = $0 }) } public var contentSize: MixAnimation { return animationFor(key: "contentSize", getter: { [weak base] in base?.contentSize }, setter: { [weak base] in base?.contentSize = $0 }) } public var zoomScale: MixAnimation { return animationFor(key: "zoomScale", getter: { [weak base] in base?.zoomScale }, setter: { [weak base] in base?.zoomScale = $0 }) } public var contentInset: MixAnimation { return animationFor(key: "contentInset", getter: { [weak base] in base?.contentInset }, setter: { [weak base] in base?.contentInset = $0 }) } public var scrollIndicatorInsets: MixAnimation { return animationFor(key: "scrollIndicatorInsets", getter: { [weak base] in base?.scrollIndicatorInsets }, setter: { [weak base] in base?.scrollIndicatorInsets = $0 }) } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Extensions/UIView+YAAL.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import UIKit extension Yaal where Base: UIView { public var center: MixAnimation { return animationFor(key: "center", getter: { [weak base] in base?.center }, setter: { [weak base] in base?.center = $0 }) } public var alpha: MixAnimation { return animationFor(key: "alpha", getter: { [weak base] in base?.alpha }, setter: { [weak base] in base?.alpha = $0 }) } public var bounds: MixAnimation { return animationFor(key: "bounds", getter: { [weak base] in base?.bounds }, setter: { [weak base] in base?.bounds = $0 }) } public var frame: MixAnimation { return animationFor(key: "frame", getter: { [weak base] in base?.frame }, setter: { [weak base] in base?.frame = $0 }) } public var backgroundColor: MixAnimation { return animationFor(key: "backgroundColor", getter: { [weak base] in base?.backgroundColor }, setter: { [weak base] in base?.backgroundColor = $0 }) } public var tintColor: MixAnimation { return animationFor(key: "tintColor", getter: { [weak base] in base?.tintColor }, setter: { [weak base] in base?.tintColor = $0 }) } public var translation: MixAnimation { return base.layer.yaal.translation } public var translationX: MixAnimation { return base.layer.yaal.translationX } public var translationY: MixAnimation { return base.layer.yaal.translationY } public var translationZ: MixAnimation { return base.layer.yaal.translationZ } public var scale: MixAnimation { return base.layer.yaal.scale } public var scaleX: MixAnimation { return base.layer.yaal.scaleX } public var scaleY: MixAnimation { return base.layer.yaal.scaleY } public var rotation: MixAnimation { return base.layer.yaal.rotation } public var rotationX: MixAnimation { return base.layer.yaal.rotationX } public var rotationY: MixAnimation { return base.layer.yaal.rotationY } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 1.4.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: Sources/YetAnotherAnimationLibrary/Solvers/Curve.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation private let epsilon: Double = 1.0 / 1000 // Following code is rewritten based on UnitBezier.h in WebKit // https://github.com/WebKit/webkit/blob/master/Source/WebCore/platform/graphics/UnitBezier.h /* * Copyright (C) 2008 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ public class Curve { public static let linear = Curve(p1x: 0, p1y: 0, p2x: 1, p2y: 1) public static let easeIn = Curve(p1x: 0.42, p1y: 0, p2x: 0, p2y: 1) public static let easeOut = Curve(p1x: 0, p1y: 0, p2x: 0.58, p2y: 1) public static let easeInOut = Curve(p1x: 0.42, p1y: 0, p2x: 0.58, p2y: 1) public init(p1x: Double, p1y: Double, p2x: Double, p2y: Double) { cx = 3 * p1x bx = 3 * (p2x - p1x) - cx ax = 1 - cx - bx cy = 3 * p1y by = 3 * (p2y - p1y) - cy ay = 1.0 - cy - by } func sampleCurveX(_ t: Double) -> Double { return ((ax * t + bx) * t + cx) * t } func sampleCurveY(_ t: Double) -> Double { return ((ay * t + by) * t + cy) * t } func sampleCurveDerivativeX(_ t: Double) -> Double { return (3.0 * ax * t + 2.0 * bx) * t + cx } func solveCurveX(_ x: Double) -> Double { var t0, t1, t2, x2, d2: Double // Firstly try a few iterations of Newton's method -- normally very fast t2 = x for _ in 0..<8 { x2 = sampleCurveX(t2) - x if fabs(x2) < epsilon { return t2 } d2 = sampleCurveDerivativeX(t2) if fabs(x2) < 1e-6 { break } t2 = t2 - x2 / d2 } // Fall back to the bisection method for reliability t0 = 0 t1 = 1 t2 = x if t2 < t0 { return t0 } if t2 > t1 { return t1 } while t0 < t1 { x2 = sampleCurveX(t2) if fabs(x2 - x) < epsilon { return t2 } if x > x2 { t0 = t2 } else { t1 = t2 } t2 = (t1 - t0) * 0.5 + t0 } // Failure return t2 } public func solve(_ x: Double) -> Double { return sampleCurveY(solveCurveX(x)) } private var ax, ay, bx, by, cx, cy: Double } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Solvers/CurveSolver.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public struct CurveSolver: Solver { public let current: AnimationProperty public let target: AnimationProperty public let velocity: AnimationProperty public let curve: Curve public let duration: TimeInterval public var start: Value.Vector public var time: TimeInterval = 0 init(duration: TimeInterval, curve: Curve, current: AnimationProperty, target: AnimationProperty, velocity: AnimationProperty) { self.current = current self.target = target self.velocity = velocity self.duration = duration self.curve = curve self.start = current.vector } public mutating func solve(dt: TimeInterval) -> Bool { time += dt if time > duration { current.vector = target.vector velocity.vector = .zero return true } let t = curve.solve(time / duration) let oldCurrent = current.vector current.vector = (target.vector - start) * t + start velocity.vector = (current.vector - oldCurrent) / dt return false } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Solvers/DecaySolver.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public struct DecaySolver: RK4Solver { public typealias Vector = Value.Vector public let damping: Double public let threshold: Double public var current: AnimationProperty! public var velocity: AnimationProperty! public init(damping: Double, threshold: Double) { self.damping = damping self.threshold = threshold } public func acceleration(current: Vector, velocity: Vector) -> Vector { return -damping * velocity } public func updateWith(newCurrent: Vector, newVelocity: Vector) -> Bool { if newVelocity.distance(between: .zero) < threshold { current.vector = newCurrent velocity.vector = .zero return true } else { current.vector = newCurrent velocity.vector = newVelocity return false } } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Solvers/RK4Solver.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public protocol RK4Solver: Solver { associatedtype Value: VectorConvertible typealias Vector = Value.Vector mutating func solve(dt: TimeInterval) -> Bool var current: AnimationProperty! { get } var velocity: AnimationProperty! { get } func acceleration(current: Vector, velocity: Vector) -> Vector func updateWith(newCurrent: Vector, newVelocity: Vector) -> Bool } extension RK4Solver { // http://gafferongames.com/game-physics/integration-basics/ public func solve(dt: TimeInterval) -> Bool { var dx = Vector.zero var dv = Vector.zero evalutate(dt: 0, dx: &dx, dv: &dv) var dxdt = dx var dvdt = dv evalutate(dt: 0.5 * dt, dx: &dx, dv: &dv) dxdt = dxdt + 2 * dx dvdt = dvdt + 2 * dv evalutate(dt: 0.5 * dt, dx: &dx, dv: &dv) dxdt = dxdt + 2 * dx dvdt = dvdt + 2 * dv evalutate(dt: dt, dx: &dx, dv: &dv) dxdt = dxdt + dx dvdt = dvdt + dv let newCurrent = current.vector + dxdt * (dt / 6.0) let newVelocity = velocity.vector + dvdt * (dt / 6.0) return updateWith(newCurrent: newCurrent, newVelocity: newVelocity) } func evalutate(dt: TimeInterval, dx: inout Vector, dv: inout Vector) { let x = current.vector + dx * dt let v = velocity.vector + dv * dt let a = acceleration(current: x, velocity: v) dx = v dv = a } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Solvers/Solver.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public protocol Solver { mutating func solve(dt: TimeInterval) -> Bool } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Solvers/SpringSolver.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public struct SpringSolver: RK4Solver { public typealias Vector = Value.Vector public let stiffness: Double public let damping: Double public let threshold: Double public var current: AnimationProperty! public var velocity: AnimationProperty! public var target: AnimationProperty! public init(stiffness: Double, damping: Double, threshold: Double) { self.stiffness = stiffness self.damping = damping self.threshold = threshold } public func acceleration(current: Vector, velocity: Vector) -> Vector { return stiffness * (target.vector - current) - damping * velocity } public func updateWith(newCurrent: Vector, newVelocity: Vector) -> Bool { if newCurrent.distance(between: target.vector) < threshold, newVelocity.distance(between: .zero) < threshold { current.vector = target.vector velocity.vector = .zero return true } else { current.vector = newCurrent velocity.vector = newVelocity return false } } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Solvers/VelocitySmoother.swift ================================================ // // VelocitySmoother.swift // Animate // // Created by Luke Zhao on 2017-04-08. // Copyright © 2017 Luke Zhao. All rights reserved. // import Foundation private let euler = M_E public struct VelocitySmoother: Solver { public let value: AnimationProperty public let velocity: AnimationProperty public let lastValue: AnimationProperty public init(value: AnimationProperty, velocity: AnimationProperty) { self.value = value self.velocity = velocity lastValue = AnimationProperty(value: value.value) } public mutating func solve(dt: TimeInterval) -> Bool { let alpha = 1 - pow(euler, -dt / 0.05) let currentVelocity = (value.vector - lastValue.vector) / dt let smoothed = velocity.vector + alpha * (currentVelocity - velocity.vector) lastValue.vector = value.vector velocity.vector = smoothed if velocity.vector.distance(between: .zero) < alpha { velocity.vector = .zero return true } return false } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Types & Operators/ChainOperator.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation public struct PipeBuilder { var root: AnimationProperty var converter: (InputValue) -> OutputValue? } precedencegroup AnimationPipePrecedence { associativity: left lowerThan: AdditionPrecedence } infix operator => : AnimationPipePrecedence public func =>(lhs: AnimationProperty, rhs: MixAnimation) { lhs.changes.addListener { [weak rhs] _, newValue in rhs?.setTo(newValue) } } public func => (lhs: PipeBuilder, rhs: MixAnimation) { lhs.root.changes.addListener { [weak rhs, converter=lhs.converter] _, newValue in if let newValue = converter(newValue) { rhs?.setTo(newValue) } } } public func => (lhs: AnimationProperty, rhs:@escaping (InputValue) -> OutputValue?) -> PipeBuilder { return PipeBuilder(root: lhs, converter: rhs) } public func => (lhs: PipeBuilder, rhs:@escaping (PipeValue) -> OutputValue?) -> PipeBuilder { return PipeBuilder(root: lhs.root) { [converter=lhs.converter] newValue in if let newValue = converter(newValue) { return rhs(newValue) } return nil } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Types & Operators/Vector.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import UIKit import simd public typealias Vector1 = Double public typealias Vector2 = SIMD2 public typealias Vector3 = SIMD3 public typealias Vector4 = SIMD4 public protocol VectorType: ExpressibleByArrayLiteral { init() static var zero: Self { get } // for looping all values one by one, not used internally static var rawValueCount: Int { get } subscript(index: Int) -> Double { get set } // arithmetic static func + (lhs: Self, rhs: Self) -> Self static func - (lhs: Self, rhs: Self) -> Self static func * (lhs: Double, rhs: Self) -> Self func distance(between: Self) -> Double } // implements VectorConvertible, so that all VectorType conform to VectorConvertible extension VectorType { public typealias Vector = Self public static func from(vector: Self) -> Self { return vector } public var vector: Self { return self } static func * (lhs: Self, rhs: Double) -> Self { rhs * lhs } static func / (lhs: Self, rhs: Double) -> Self { lhs * (1 / rhs) } public func distance(between: Self) -> Double { var result = 0.0 for i in 0.. Double { get { return self } set { self = newValue } } public init(arrayLiteral elements: Double...) { self = elements[0] } public func distance(between: Double) -> Double { return abs(self - between) } } extension SIMD16: VectorType, VectorConvertible where Scalar == Double { public static var zero: SIMD16 = SIMD16() public static var rawValueCount: Int { 16 } public static func * (lhs: Double, rhs: SIMD16) -> SIMD16 { [lhs * rhs[0], lhs * rhs[1], lhs * rhs[2], lhs * rhs[3], lhs * rhs[4], lhs * rhs[5], lhs * rhs[6], lhs * rhs[7], lhs * rhs[8], lhs * rhs[9], lhs * rhs[10], lhs * rhs[11], lhs * rhs[12], lhs * rhs[13], lhs * rhs[14], lhs * rhs[15]] } } extension SIMD2: VectorType, VectorConvertible where Scalar == Double { public static var zero = SIMD2() public static var rawValueCount: Int { 2 } public func distance(between: SIMD2) -> Double { simd.distance(self, between) } } extension SIMD3: VectorType, VectorConvertible where Scalar == Double { public static var zero = SIMD3() public static var rawValueCount: Int { 3 } public func distance(between: SIMD3) -> Double { simd.distance(self, between) } } extension SIMD4: VectorType, VectorConvertible where Scalar == Double { public static var zero = SIMD4() public static var rawValueCount: Int { 4 } public func distance(between: SIMD4) -> Double { simd.distance(self, between) } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/Types & Operators/VectorConvertible.swift ================================================ // The MIT License (MIT) // // Copyright (c) 2016 Luke Zhao // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import UIKit public protocol VectorConvertible { associatedtype Vector: VectorType static func from(vector: Vector) -> Self var vector: Vector { get } } extension Float: VectorConvertible { public typealias Vector = Vector1 public static func from(vector: Vector1) -> Float { return Float(vector) } public var vector: Vector1 { return Vector1(self) } } extension CGFloat: VectorConvertible { public typealias Vector = Vector1 public static func from(vector: Vector1) -> CGFloat { return CGFloat(vector) } public var vector: Vector1 { return Vector1(self) } } extension CGPoint: VectorConvertible { public typealias Vector = Vector2 public static func from(vector: Vector2) -> CGPoint { return CGPoint(x: vector.x, y: vector.y) } public var vector: Vector2 { return [Double(x), Double(y)] } } extension CGSize: VectorConvertible { public typealias Vector = Vector2 public static func from(vector: Vector2) -> CGSize { return CGSize(width: vector.x, height: vector.y) } public var vector: Vector2 { return [Double(width), Double(height)] } } extension CGRect: VectorConvertible { public typealias Vector = Vector4 public static func from(vector: Vector4) -> CGRect { return CGRect(x: vector.x, y: vector.y, width: vector.z, height: vector.w) } public var vector: Vector4 { return [Double(origin.x), Double(origin.y), Double(width), Double(height)] } } extension UIEdgeInsets: VectorConvertible { public typealias Vector = Vector4 public static func from(vector: Vector4) -> UIEdgeInsets { return UIEdgeInsets(top: CGFloat(vector.x), left: CGFloat(vector.y), bottom: CGFloat(vector.z), right: CGFloat(vector.w)) } public var vector: Vector4 { return [Double(top), Double(left), Double(bottom), Double(right)] } } extension CGColor: VectorConvertible { private static let rgbColorSpace = CGColorSpaceCreateDeviceRGB() public typealias Vector = Vector4 public static func from(vector: Vector4) -> Self { let components = [CGFloat(vector.x), CGFloat(vector.y), CGFloat(vector.z), CGFloat(vector.w)] let color = self.init(colorSpace: CGColor.rgbColorSpace, components: components)! return color } public var vector: Vector4 { var rtn = Vector4() if let components = components { if 4 == numberOfComponents { // RGB colorspace rtn[0] = Double(components[0]) rtn[1] = Double(components[1]) rtn[2] = Double(components[2]) rtn[3] = Double(components[3]) } else if 2 == numberOfComponents { // Grey colorspace rtn[0] = Double(components[0]) rtn[1] = Double(components[0]) rtn[2] = Double(components[0]) rtn[3] = Double(components[1]) } else { // Use CI to convert let ciColor = CIColor(cgColor: self) rtn[0] = Double(ciColor.red) rtn[1] = Double(ciColor.green) rtn[2] = Double(ciColor.blue) rtn[3] = Double(ciColor.alpha) } } return rtn } } extension UIColor: VectorConvertible { public typealias Vector = Vector4 public static func from(vector: Vector4) -> Self { return self.init(cgColor: CGColor.from(vector: vector)) } public var vector: Vector4 { return cgColor.vector } } ================================================ FILE: Sources/YetAnotherAnimationLibrary/YaalCompatible.swift ================================================ // // YaalCompatible.swift // YetAnotherAnimationLibrary // // Created by Anton Siliuk on 21.04.17. // Copyright © 2017 Luke Zhao. All rights reserved. // import Foundation public struct Yaal { /// Base object to extend. public let base: Base /// Creates extensions with base object. /// /// - parameter base: Base object. public init(_ base: Base) { self.base = base } } /// A type that has yaal extensions. public protocol YaalCompatible { /// Extended type associatedtype CompatibleType /// Yaal extensions. static var yaal: Yaal.Type { get set } /// Yaal extensions. var yaal: Yaal { get set } } extension YaalCompatible { /// Yaal extensions. public static var yaal: Yaal.Type { get { return Yaal.self } set { // this enables using Yaal to "mutate" base type } } /// Yaal extensions. public var yaal: Yaal { get { return Yaal(self) } set { // this enables using Yaal to "mutate" base object } } } extension NSObject: YaalCompatible {} ================================================ FILE: YetAnotherAnimationLibrary.podspec ================================================ Pod::Spec.new do |s| s.name = "YetAnotherAnimationLibrary" s.version = "1.5.0" s.summary = "Designed for gesture-driven animations. Simple, fast and extensible." s.description = <<-DESC Designed for gesture-driven animations. Simple, fast and extensible. It is written in pure swift with protocol oriented design and extensive use of generics. DESC s.homepage = "https://github.com/lkzhao/YetAnotherAnimationLibrary" s.license = 'MIT' s.author = { "Luke" => "lzhaoyilun@gmail.com" } s.source = { :git => "https://github.com/lkzhao/YetAnotherAnimationLibrary.git", :tag => s.version.to_s } s.ios.deployment_target = '8.0' s.tvos.deployment_target = '9.0' s.ios.frameworks = 'UIKit', 'Foundation' s.requires_arc = true s.swift_versions = ['5.0'] s.source_files = 'Sources/**/*.swift' end ================================================ FILE: YetAnotherAnimationLibrary.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 8CCFCB181EAA011B008345FC /* YaalCompatible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CCFCB171EAA011B008345FC /* YaalCompatible.swift */; }; B11C9F5D1E903671004916D1 /* CardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B11C9F5C1E903671004916D1 /* CardViewController.swift */; }; B16E80F01E99584B00E95C31 /* SolverAnimatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B16E80EF1E99584B00E95C31 /* SolverAnimatable.swift */; }; B16E80F41E995A2C00E95C31 /* CurveSolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B16E80F31E995A2C00E95C31 /* CurveSolver.swift */; }; B16E80F61E995A3300E95C31 /* DecaySolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B16E80F51E995A3300E95C31 /* DecaySolver.swift */; }; B16E80F81E995A3900E95C31 /* SpringSolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B16E80F71E995A3900E95C31 /* SpringSolver.swift */; }; B16E80FA1E995A4500E95C31 /* RK4Solver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B16E80F91E995A4500E95C31 /* RK4Solver.swift */; }; B16E80FD1E995ABF00E95C31 /* SpringAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B16E80FC1E995ABE00E95C31 /* SpringAnimation.swift */; }; B16E80FF1E995AC500E95C31 /* CurveAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B16E80FE1E995AC500E95C31 /* CurveAnimation.swift */; }; B16E81011E995AD700E95C31 /* DecayAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B16E81001E995AD700E95C31 /* DecayAnimation.swift */; }; B16E81031E9962C300E95C31 /* SolvableAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B16E81021E9962C300E95C31 /* SolvableAnimation.swift */; }; B17BB1BA1E9BEDB000D287BA /* Animatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17BB1B91E9BEDB000D287BA /* Animatable.swift */; }; B17BB1BC1E9BEDD400D287BA /* CurveAnimatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17BB1BB1E9BEDD400D287BA /* CurveAnimatable.swift */; }; B17BB1BE1E9BEDE000D287BA /* DecayAnimatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17BB1BD1E9BEDE000D287BA /* DecayAnimatable.swift */; }; B17BB1C01E9BEDEF00D287BA /* SpringAnimatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17BB1BF1E9BEDEF00D287BA /* SpringAnimatable.swift */; }; B17F18F31E8EE34800D2FA3D /* Solver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17F18F21E8EE34800D2FA3D /* Solver.swift */; }; B197CE1E1E8B660F004495AE /* YetAnotherAnimationLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B197CE171E8B660F004495AE /* YetAnotherAnimationLibrary.framework */; }; B197CE1F1E8B660F004495AE /* YetAnotherAnimationLibrary.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B197CE171E8B660F004495AE /* YetAnotherAnimationLibrary.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B197CE251E8B6615004495AE /* ValueAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B197CE101E8B146F004495AE /* ValueAnimation.swift */; }; B197CE261E8B6615004495AE /* Animation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B197CE0B1E8B0F94004495AE /* Animation.swift */; }; B197CE271E8B6615004495AE /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B197CE091E8B0F6E004495AE /* Animator.swift */; }; B197CE281E8B6615004495AE /* DisplayLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C2ED181E8AE6E1005F0081 /* DisplayLink.swift */; }; B197CE291E8B6615004495AE /* VectorConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = B197CE0E1E8B0FF3004495AE /* VectorConvertible.swift */; }; B197CE2A1E8B6615004495AE /* Vector.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DC14D01E8B08BD00933896 /* Vector.swift */; }; B197CE2F1E8C50E9004495AE /* UIView+YAAL.swift in Sources */ = {isa = PBXBuildFile; fileRef = B197CE2E1E8C50E9004495AE /* UIView+YAAL.swift */; }; B197CE351E8D7E95004495AE /* Announcer.swift in Sources */ = {isa = PBXBuildFile; fileRef = B197CE341E8D7E95004495AE /* Announcer.swift */; }; B197CE371E8D91CB004495AE /* AnimationProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = B197CE361E8D91CB004495AE /* AnimationProperty.swift */; }; B1A54F721EA0002E00A96112 /* NSObject+YAAL.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1A54F711EA0002E00A96112 /* NSObject+YAAL.swift */; }; B1A54F741EA0004400A96112 /* CALayer+YAAL.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1A54F731EA0004400A96112 /* CALayer+YAAL.swift */; }; B1A54F761EA0007200A96112 /* UILabel+YAAL.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1A54F751EA0007200A96112 /* UILabel+YAAL.swift */; }; B1A54F791EA00E6200A96112 /* UIScrollView+YAAL.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1A54F781EA00E6200A96112 /* UIScrollView+YAAL.swift */; }; B1D0B4801E89C479000B0E24 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1D0B47F1E89C479000B0E24 /* AppDelegate.swift */; }; B1D0B4821E89C479000B0E24 /* GestureViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1D0B4811E89C479000B0E24 /* GestureViewController.swift */; }; B1D0B4851E89C479000B0E24 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B1D0B4831E89C479000B0E24 /* Main.storyboard */; }; B1D0B4871E89C479000B0E24 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B1D0B4861E89C479000B0E24 /* Assets.xcassets */; }; B1D0B48A1E89C479000B0E24 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B1D0B4881E89C479000B0E24 /* LaunchScreen.storyboard */; }; B1F346211E99923C002E15D7 /* ChainOperator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1F346201E99923C002E15D7 /* ChainOperator.swift */; }; B1F346231E99927E002E15D7 /* VelocitySmoother.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1F346221E99927E002E15D7 /* VelocitySmoother.swift */; }; B1FE700B1E8DEC1B00CF9840 /* Curve.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1FE700A1E8DEC1B00CF9840 /* Curve.swift */; }; B1FE700D1E8DF33700CF9840 /* MixAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1FE700C1E8DF33700CF9840 /* MixAnimation.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ B197CE1C1E8B660F004495AE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = B1D0B4741E89C479000B0E24 /* Project object */; proxyType = 1; remoteGlobalIDString = B197CE161E8B660F004495AE; remoteInfo = Animate; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ B197CE231E8B660F004495AE /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( B197CE1F1E8B660F004495AE /* YetAnotherAnimationLibrary.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 8CCFCB171EAA011B008345FC /* YaalCompatible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YaalCompatible.swift; sourceTree = ""; }; B11C9F5C1E903671004916D1 /* CardViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardViewController.swift; sourceTree = ""; }; B16E80EF1E99584B00E95C31 /* SolverAnimatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SolverAnimatable.swift; sourceTree = ""; }; B16E80F31E995A2C00E95C31 /* CurveSolver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurveSolver.swift; sourceTree = ""; }; B16E80F51E995A3300E95C31 /* DecaySolver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecaySolver.swift; sourceTree = ""; }; B16E80F71E995A3900E95C31 /* SpringSolver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpringSolver.swift; sourceTree = ""; }; B16E80F91E995A4500E95C31 /* RK4Solver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RK4Solver.swift; sourceTree = ""; }; B16E80FC1E995ABE00E95C31 /* SpringAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpringAnimation.swift; sourceTree = ""; }; B16E80FE1E995AC500E95C31 /* CurveAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurveAnimation.swift; sourceTree = ""; }; B16E81001E995AD700E95C31 /* DecayAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecayAnimation.swift; sourceTree = ""; }; B16E81021E9962C300E95C31 /* SolvableAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SolvableAnimation.swift; sourceTree = ""; }; B17BB1B91E9BEDB000D287BA /* Animatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animatable.swift; sourceTree = ""; }; B17BB1BB1E9BEDD400D287BA /* CurveAnimatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurveAnimatable.swift; sourceTree = ""; }; B17BB1BD1E9BEDE000D287BA /* DecayAnimatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecayAnimatable.swift; sourceTree = ""; }; B17BB1BF1E9BEDEF00D287BA /* SpringAnimatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpringAnimatable.swift; sourceTree = ""; }; B17F18F21E8EE34800D2FA3D /* Solver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Solver.swift; sourceTree = ""; }; B197CE091E8B0F6E004495AE /* Animator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animator.swift; sourceTree = ""; }; B197CE0B1E8B0F94004495AE /* Animation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animation.swift; sourceTree = ""; }; B197CE0E1E8B0FF3004495AE /* VectorConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VectorConvertible.swift; sourceTree = ""; }; B197CE101E8B146F004495AE /* ValueAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueAnimation.swift; sourceTree = ""; }; B197CE171E8B660F004495AE /* YetAnotherAnimationLibrary.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YetAnotherAnimationLibrary.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B197CE1A1E8B660F004495AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; B197CE2E1E8C50E9004495AE /* UIView+YAAL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+YAAL.swift"; sourceTree = ""; }; B197CE341E8D7E95004495AE /* Announcer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Announcer.swift; sourceTree = ""; }; B197CE361E8D91CB004495AE /* AnimationProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimationProperty.swift; sourceTree = ""; }; B1A54F711EA0002E00A96112 /* NSObject+YAAL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSObject+YAAL.swift"; sourceTree = ""; }; B1A54F731EA0004400A96112 /* CALayer+YAAL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CALayer+YAAL.swift"; sourceTree = ""; }; B1A54F751EA0007200A96112 /* UILabel+YAAL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+YAAL.swift"; sourceTree = ""; }; B1A54F781EA00E6200A96112 /* UIScrollView+YAAL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIScrollView+YAAL.swift"; sourceTree = ""; }; B1C2ED181E8AE6E1005F0081 /* DisplayLink.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplayLink.swift; sourceTree = ""; }; B1D0B47C1E89C479000B0E24 /* Examples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Examples.app; sourceTree = BUILT_PRODUCTS_DIR; }; B1D0B47F1E89C479000B0E24 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; B1D0B4811E89C479000B0E24 /* GestureViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GestureViewController.swift; sourceTree = ""; }; B1D0B4841E89C479000B0E24 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; B1D0B4861E89C479000B0E24 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; B1D0B4891E89C479000B0E24 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; B1D0B48B1E89C479000B0E24 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; B1DC14D01E8B08BD00933896 /* Vector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Vector.swift; sourceTree = ""; }; B1F346201E99923C002E15D7 /* ChainOperator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChainOperator.swift; sourceTree = ""; }; B1F346221E99927E002E15D7 /* VelocitySmoother.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VelocitySmoother.swift; sourceTree = ""; }; B1FE700A1E8DEC1B00CF9840 /* Curve.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Curve.swift; sourceTree = ""; }; B1FE700C1E8DF33700CF9840 /* MixAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MixAnimation.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ B197CE131E8B660F004495AE /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; B1D0B4791E89C479000B0E24 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( B197CE1E1E8B660F004495AE /* YetAnotherAnimationLibrary.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ B16E80F11E99585B00E95C31 /* Animator */ = { isa = PBXGroup; children = ( B197CE091E8B0F6E004495AE /* Animator.swift */, B1C2ED181E8AE6E1005F0081 /* DisplayLink.swift */, ); path = Animator; sourceTree = ""; }; B16E80F21E99586D00E95C31 /* Animations */ = { isa = PBXGroup; children = ( B197CE0B1E8B0F94004495AE /* Animation.swift */, B16E80FE1E995AC500E95C31 /* CurveAnimation.swift */, B16E81001E995AD700E95C31 /* DecayAnimation.swift */, B1FE700C1E8DF33700CF9840 /* MixAnimation.swift */, B16E81021E9962C300E95C31 /* SolvableAnimation.swift */, B16E80FC1E995ABE00E95C31 /* SpringAnimation.swift */, B197CE101E8B146F004495AE /* ValueAnimation.swift */, ); path = Animations; sourceTree = ""; }; B16E80FB1E995A7300E95C31 /* Solvers */ = { isa = PBXGroup; children = ( B1FE700A1E8DEC1B00CF9840 /* Curve.swift */, B16E80F31E995A2C00E95C31 /* CurveSolver.swift */, B16E80F51E995A3300E95C31 /* DecaySolver.swift */, B16E80F91E995A4500E95C31 /* RK4Solver.swift */, B17F18F21E8EE34800D2FA3D /* Solver.swift */, B16E80F71E995A3900E95C31 /* SpringSolver.swift */, B1F346221E99927E002E15D7 /* VelocitySmoother.swift */, ); path = Solvers; sourceTree = ""; }; B17BB1C11E9BEE2400D287BA /* Animatables */ = { isa = PBXGroup; children = ( B17BB1B91E9BEDB000D287BA /* Animatable.swift */, B17BB1BB1E9BEDD400D287BA /* CurveAnimatable.swift */, B17BB1BD1E9BEDE000D287BA /* DecayAnimatable.swift */, B16E80EF1E99584B00E95C31 /* SolverAnimatable.swift */, B17BB1BF1E9BEDEF00D287BA /* SpringAnimatable.swift */, ); path = Animatables; sourceTree = ""; }; B17BB1C21E9BEE4F00D287BA /* AnimationProperty */ = { isa = PBXGroup; children = ( B197CE361E8D91CB004495AE /* AnimationProperty.swift */, B197CE341E8D7E95004495AE /* Announcer.swift */, ); path = AnimationProperty; sourceTree = ""; }; B17BB1C31E9BEE6B00D287BA /* Types & Operators */ = { isa = PBXGroup; children = ( B1F346201E99923C002E15D7 /* ChainOperator.swift */, B1DC14D01E8B08BD00933896 /* Vector.swift */, B197CE0E1E8B0FF3004495AE /* VectorConvertible.swift */, ); path = "Types & Operators"; sourceTree = ""; }; B197CE0D1E8B0FB1004495AE /* Sources */ = { isa = PBXGroup; children = ( 8CCFCB171EAA011B008345FC /* YaalCompatible.swift */, B17BB1C11E9BEE2400D287BA /* Animatables */, B17BB1C21E9BEE4F00D287BA /* AnimationProperty */, B16E80F21E99586D00E95C31 /* Animations */, B16E80F11E99585B00E95C31 /* Animator */, B1A54F771EA0009800A96112 /* Extensions */, B16E80FB1E995A7300E95C31 /* Solvers */, B17BB1C31E9BEE6B00D287BA /* Types & Operators */, B197CE1A1E8B660F004495AE /* Info.plist */, ); path = Sources; sourceTree = ""; }; B1A54F771EA0009800A96112 /* Extensions */ = { isa = PBXGroup; children = ( B1A54F711EA0002E00A96112 /* NSObject+YAAL.swift */, B1A54F731EA0004400A96112 /* CALayer+YAAL.swift */, B1A54F751EA0007200A96112 /* UILabel+YAAL.swift */, B1A54F781EA00E6200A96112 /* UIScrollView+YAAL.swift */, B197CE2E1E8C50E9004495AE /* UIView+YAAL.swift */, ); path = Extensions; sourceTree = ""; }; B1D0B4731E89C479000B0E24 = { isa = PBXGroup; children = ( B1D0B47E1E89C479000B0E24 /* Examples */, B1D0B47D1E89C479000B0E24 /* Products */, B197CE0D1E8B0FB1004495AE /* Sources */, ); indentWidth = 4; sourceTree = ""; tabWidth = 4; }; B1D0B47D1E89C479000B0E24 /* Products */ = { isa = PBXGroup; children = ( B1D0B47C1E89C479000B0E24 /* Examples.app */, B197CE171E8B660F004495AE /* YetAnotherAnimationLibrary.framework */, ); name = Products; sourceTree = ""; }; B1D0B47E1E89C479000B0E24 /* Examples */ = { isa = PBXGroup; children = ( B1F346241E999371002E15D7 /* Supporting Files */, B11C9F5C1E903671004916D1 /* CardViewController.swift */, B1D0B4811E89C479000B0E24 /* GestureViewController.swift */, ); path = Examples; sourceTree = ""; }; B1F346241E999371002E15D7 /* Supporting Files */ = { isa = PBXGroup; children = ( B1D0B47F1E89C479000B0E24 /* AppDelegate.swift */, B1D0B4861E89C479000B0E24 /* Assets.xcassets */, B1D0B48B1E89C479000B0E24 /* Info.plist */, B1D0B4881E89C479000B0E24 /* LaunchScreen.storyboard */, B1D0B4831E89C479000B0E24 /* Main.storyboard */, ); path = "Supporting Files"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ B197CE141E8B660F004495AE /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ B197CE161E8B660F004495AE /* YetAnotherAnimationLibrary */ = { isa = PBXNativeTarget; buildConfigurationList = B197CE201E8B660F004495AE /* Build configuration list for PBXNativeTarget "YetAnotherAnimationLibrary" */; buildPhases = ( B17BB1C41E9BEEDC00D287BA /* Swiftlint */, B197CE121E8B660F004495AE /* Sources */, B197CE131E8B660F004495AE /* Frameworks */, B197CE141E8B660F004495AE /* Headers */, B197CE151E8B660F004495AE /* Resources */, ); buildRules = ( ); dependencies = ( ); name = YetAnotherAnimationLibrary; productName = Animate; productReference = B197CE171E8B660F004495AE /* YetAnotherAnimationLibrary.framework */; productType = "com.apple.product-type.framework"; }; B1D0B47B1E89C479000B0E24 /* Examples */ = { isa = PBXNativeTarget; buildConfigurationList = B1D0B48E1E89C479000B0E24 /* Build configuration list for PBXNativeTarget "Examples" */; buildPhases = ( B1D0B4781E89C479000B0E24 /* Sources */, B1D0B4791E89C479000B0E24 /* Frameworks */, B1D0B47A1E89C479000B0E24 /* Resources */, B197CE231E8B660F004495AE /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( B197CE1D1E8B660F004495AE /* PBXTargetDependency */, ); name = Examples; productName = SpringAnimator; productReference = B1D0B47C1E89C479000B0E24 /* Examples.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ B1D0B4741E89C479000B0E24 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Luke Zhao"; TargetAttributes = { B197CE161E8B660F004495AE = { CreatedOnToolsVersion = 8.2; DevelopmentTeam = 4VSEW78TKT; LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; B1D0B47B1E89C479000B0E24 = { CreatedOnToolsVersion = 8.2; DevelopmentTeam = 4VSEW78TKT; LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = B1D0B4771E89C479000B0E24 /* Build configuration list for PBXProject "YetAnotherAnimationLibrary" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = B1D0B4731E89C479000B0E24; productRefGroup = B1D0B47D1E89C479000B0E24 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( B1D0B47B1E89C479000B0E24 /* Examples */, B197CE161E8B660F004495AE /* YetAnotherAnimationLibrary */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ B197CE151E8B660F004495AE /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; B1D0B47A1E89C479000B0E24 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( B1D0B48A1E89C479000B0E24 /* LaunchScreen.storyboard in Resources */, B1D0B4871E89C479000B0E24 /* Assets.xcassets in Resources */, B1D0B4851E89C479000B0E24 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ B17BB1C41E9BEEDC00D287BA /* Swiftlint */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 12; files = ( ); inputPaths = ( ); name = Swiftlint; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ B197CE121E8B660F004495AE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( B1F346231E99927E002E15D7 /* VelocitySmoother.swift in Sources */, B17BB1BA1E9BEDB000D287BA /* Animatable.swift in Sources */, B1FE700B1E8DEC1B00CF9840 /* Curve.swift in Sources */, B16E80F61E995A3300E95C31 /* DecaySolver.swift in Sources */, B197CE291E8B6615004495AE /* VectorConvertible.swift in Sources */, B16E80F41E995A2C00E95C31 /* CurveSolver.swift in Sources */, B197CE371E8D91CB004495AE /* AnimationProperty.swift in Sources */, B197CE281E8B6615004495AE /* DisplayLink.swift in Sources */, B197CE2F1E8C50E9004495AE /* UIView+YAAL.swift in Sources */, B16E81031E9962C300E95C31 /* SolvableAnimation.swift in Sources */, B1A54F791EA00E6200A96112 /* UIScrollView+YAAL.swift in Sources */, B17BB1BC1E9BEDD400D287BA /* CurveAnimatable.swift in Sources */, B197CE271E8B6615004495AE /* Animator.swift in Sources */, B1FE700D1E8DF33700CF9840 /* MixAnimation.swift in Sources */, 8CCFCB181EAA011B008345FC /* YaalCompatible.swift in Sources */, B197CE2A1E8B6615004495AE /* Vector.swift in Sources */, B17F18F31E8EE34800D2FA3D /* Solver.swift in Sources */, B16E80F81E995A3900E95C31 /* SpringSolver.swift in Sources */, B1A54F741EA0004400A96112 /* CALayer+YAAL.swift in Sources */, B1A54F761EA0007200A96112 /* UILabel+YAAL.swift in Sources */, B197CE251E8B6615004495AE /* ValueAnimation.swift in Sources */, B16E81011E995AD700E95C31 /* DecayAnimation.swift in Sources */, B197CE261E8B6615004495AE /* Animation.swift in Sources */, B16E80F01E99584B00E95C31 /* SolverAnimatable.swift in Sources */, B1A54F721EA0002E00A96112 /* NSObject+YAAL.swift in Sources */, B16E80FF1E995AC500E95C31 /* CurveAnimation.swift in Sources */, B16E80FD1E995ABF00E95C31 /* SpringAnimation.swift in Sources */, B1F346211E99923C002E15D7 /* ChainOperator.swift in Sources */, B197CE351E8D7E95004495AE /* Announcer.swift in Sources */, B17BB1BE1E9BEDE000D287BA /* DecayAnimatable.swift in Sources */, B17BB1C01E9BEDEF00D287BA /* SpringAnimatable.swift in Sources */, B16E80FA1E995A4500E95C31 /* RK4Solver.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; B1D0B4781E89C479000B0E24 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( B1D0B4821E89C479000B0E24 /* GestureViewController.swift in Sources */, B11C9F5D1E903671004916D1 /* CardViewController.swift in Sources */, B1D0B4801E89C479000B0E24 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ B197CE1D1E8B660F004495AE /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = B197CE161E8B660F004495AE /* YetAnotherAnimationLibrary */; targetProxy = B197CE1C1E8B660F004495AE /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ B1D0B4831E89C479000B0E24 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( B1D0B4841E89C479000B0E24 /* Base */, ); name = Main.storyboard; path = .; sourceTree = ""; }; B1D0B4881E89C479000B0E24 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( B1D0B4891E89C479000B0E24 /* Base */, ); name = LaunchScreen.storyboard; path = .; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ B197CE211E8B660F004495AE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 4VSEW78TKT; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.YetAnotherAnimationLibrary; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; B197CE221E8B660F004495AE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 4VSEW78TKT; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.YetAnotherAnimationLibrary; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; B1D0B48C1E89C479000B0E24 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; B1D0B48D1E89C479000B0E24 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; B1D0B48F1E89C479000B0E24 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 4VSEW78TKT; INFOPLIST_FILE = "Examples/Supporting Files/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.YetAnotherAnimationLibraryExamples; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_INSTALL_OBJC_HEADER = NO; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_VERSION = 5.0; }; name = Debug; }; B1D0B4901E89C479000B0E24 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 4VSEW78TKT; INFOPLIST_FILE = "Examples/Supporting Files/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.YetAnotherAnimationLibraryExamples; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_INSTALL_OBJC_HEADER = NO; SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_VERSION = 5.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ B197CE201E8B660F004495AE /* Build configuration list for PBXNativeTarget "YetAnotherAnimationLibrary" */ = { isa = XCConfigurationList; buildConfigurations = ( B197CE211E8B660F004495AE /* Debug */, B197CE221E8B660F004495AE /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; B1D0B4771E89C479000B0E24 /* Build configuration list for PBXProject "YetAnotherAnimationLibrary" */ = { isa = XCConfigurationList; buildConfigurations = ( B1D0B48C1E89C479000B0E24 /* Debug */, B1D0B48D1E89C479000B0E24 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; B1D0B48E1E89C479000B0E24 /* Build configuration list for PBXNativeTarget "Examples" */ = { isa = XCConfigurationList; buildConfigurations = ( B1D0B48F1E89C479000B0E24 /* Debug */, B1D0B4901E89C479000B0E24 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = B1D0B4741E89C479000B0E24 /* Project object */; } ================================================ FILE: YetAnotherAnimationLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: YetAnotherAnimationLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: YetAnotherAnimationLibrary.xcodeproj/xcshareddata/xcschemes/YetAnotherAnimationLibrary.xcscheme ================================================