A library that implements easing functions in Swift.
- iOS, macOS, tvOS, watchOS and Linux (latest Ubuntu).
Type of supported functions:
Each type has its own separate ease-In, ease-Out and ease-In-Out form.
The functions are design to accept a generic floating-point input parameter, and return a floating-point, denoting the rate of change of a property over time.
Supported argument types:
- Any type that conforms to the
The Curve type allows access to all the different functions, for example:
let x: Float = 0.3 let y = Curve.quadratic.easeIn(x) // y = 0.09
let x: Double = 0.5 let y = Curve.sine.easeOut(x2) // y = 0.7071067811865
Here's an example of the use of the elastic ease-in-out function in an array of 75 points in the [0, 1] interval.
Swift Package Manager (iOS, macOS, tvOS, watchOS and Linux)
Easing to your package manifest as a dependency, by adding the github URL to your
// swift-tools-version:4.0 import PackageDescription let package = Package( name: "MyAwsomeProject", dependencies: [ .package(url: "https://github.com/manuelCarlos/Easing.git", .upToNextMajor(from: "2.0.0")) ], targets: [ .target( name: "MyAwsomeProject", dependencies: ["Easing"]) ] )
To quickly generate a Xcode project, navigate to the project folder in the terminal and run:
swift package generate-xcodeproj
(In order to generate an
Easing.xcodeprojfrom the project's
Package.swift, be sure to have the Swift compiler installed and
Swiftadded to your $PATH)
To quickly run the tests:
swift test --enable-test-discovery(in Linux).
RealModulefrom the Swift Numerics package.